当前位置: 首页>>代码示例>>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;未经允许,请勿转载。