當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Password::create方法代碼示例

本文整理匯總了PHP中Password::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Password::create方法的具體用法?PHP Password::create怎麽用?PHP Password::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Password的用法示例。


在下文中一共展示了Password::create方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create

    public function create($request)
    {
        $req = $request->getParameters();
        $data = array();
        $data['currentPageTitle'] = 'Mot de passe oublié';
        $resp = new ViewResponse('password/password', $data);
        if (!empty($req['email']) xor !empty($req['pseudo'])) {
            if (!empty($req['email'])) {
                if (Utils::validateMail($req['email'])) {
                    if (User::exists(array('email' => $req['email']))) {
                        $user_id = User::find(array('email' => $req['email']))->id;
                        $email = $req['email'];
                    } else {
                        $resp->addMessage(ViewMessage::error('Cette adresse E-Mail n\'est associée à aucun compte.'));
                        return $resp;
                    }
                } else {
                    $resp->addMessage(ViewMessage::error('Merci de renseigner une adresse E-Mail valide !'));
                    return $resp;
                }
            } else {
                if (!empty($req['pseudo'])) {
                    if (User::exists(array('username' => $req['pseudo']))) {
                        $user_id = User::find(array('username' => $req['pseudo']))->id;
                        $email = User::find(array('username' => $req['pseudo']))->email;
                    } else {
                        $resp->addMessage(ViewMessage::error('Ce Pseudo n\'est associé à aucun compte.'));
                        return $resp;
                    }
                }
            }
            $key = md5(uniqid());
            Password::create(array('user_id' => $user_id, 'key' => $key));
            $headers = 'From: DreamVids <ne-pas-repondre@dreamvids.fr>' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n";
            $message = 'Vous avez demandé la réinitialisation de votre mot de passe DreamVids. Clique sur le lien ci-dessous pour accéder à votre nouveau mot de passe :<br /><br />
			<a href="http://dreamvids.fr/password/' . $key . '">http://dreamvids.fr/password/' . $key . '</a>';
            mail($email, 'DreamVids - Mot de passe oublié', $message, $headers);
            $resp->addMessage(ViewMessage::success('Vous allez recevoir un E-Mail à l\'adresse ' . $email . ', suivez-en les instructions.'));
        } else {
            $resp->addMessage(ViewMessage::error('Merci de renseigner une Adresse E-Mail OU un Pseudo.'));
        }
        return $resp;
    }
開發者ID:boulama,項目名稱:DreamVids,代碼行數:43,代碼來源:password_controller.php

示例2: generatePassword

 public function generatePassword()
 {
     ClassLoader::import("library.text.Password");
     return new RawResponse(Password::create(10, Password::MIX));
 }
開發者ID:saiber,項目名稱:livecart,代碼行數:5,代碼來源:UserController.php

示例3: createByType

 /**
  * @param $fieldname
  * @param $type
  * @return static
  */
 public static final function createByType($fieldname, $type)
 {
     switch ($type) {
         case static::Type_Text:
             return Text::create($fieldname);
         case static::Type_Password:
             return Password::create($fieldname);
         case static::Type_TextArea:
             return TextArea::create($fieldname);
         case static::Type_CheckGroup:
             return CheckGroup::create($fieldname);
         case static::Type_RadioGroup:
             return RadioGroup::create($fieldname);
         case static::Type_Select:
             return Select::create($fieldname);
         case static::Type_MultiSelect:
             return MultiSelect::create($fieldname);
         case static::Type_Image:
             return Image::create($fieldname);
         case static::Type_MultiImage:
             return MultiImage::create($fieldname);
         case static::Type_Tags:
             return Tags::create($fieldname);
         case static::Type_Article:
             return Article::create($fieldname);
         case static::Type_Date:
             return Date::create($fieldname);
         case static::Type_SelectItem:
             return SelectItem::create($fieldname);
         case static::Type_DateTime:
             return DateTime::create($fieldname);
         case static::Type_DateRange:
             return DateRange::create($fieldname);
         case static::Type_Appendable:
             return Appendable::create($fieldname);
     }
 }
開發者ID:xjtuwangke,項目名稱:laravel-kform,代碼行數:42,代碼來源:FormFieldBase.php


注:本文中的Password::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。