当前位置: 首页>>代码示例>>PHP>>正文


PHP UserHelper::generateRandomPassword方法代码示例

本文整理汇总了PHP中UserHelper::generateRandomPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::generateRandomPassword方法的具体用法?PHP UserHelper::generateRandomPassword怎么用?PHP UserHelper::generateRandomPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserHelper的用法示例。


在下文中一共展示了UserHelper::generateRandomPassword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionResetPassword

 /**
  * Generates a new random password and then send it via email to the user.
  */
 public function actionResetPassword()
 {
     $model = new ResetPasswordForm();
     $success = false;
     $email = '';
     if (isset($_POST['ResetPasswordForm'])) {
         $model->attributes = $_POST['ResetPasswordForm'];
         $this->performAjaxValidation($model);
         $user = User::model()->findByAttributes(array('email' => $model->email));
         if (isset($user)) {
             $email = $user->email;
             $password_clear = UserHelper::generateRandomPassword();
             $user->password = $user->changeAccountPassword($password_clear);
             if ($user->save()) {
                 /* write an INFO syslog */
                 BasicNotifier::sendTemplatedEmail($user->email, Yii::t('UsersModule.resetPassword', 'email.subject'), 'users/account_reset_password', array('{USER_PASSWORD}' => $password_clear), Yii::app()->session['lang']);
                 $success = true;
             }
         }
     }
     $this->render('resetPassword', array('model' => $model, 'success' => $success, 'email' => $email));
 }
开发者ID:bafio89,项目名称:qea-u,代码行数:25,代码来源:AccountController.php

示例2: control_efetuar_cadastro

 public function control_efetuar_cadastro()
 {
     $this->titulo = 'Cadastre-se';
     if ($this->isPostRequest) {
         $senhaTemporaria = UserHelper::generateRandomPassword();
         try {
             $d = new Usuarios($_POST);
             $this->em->persist($d);
             $this->em->flush();
         } catch (Exception $ex) {
             $this->adicionarMensagemErro('Ocorreu um erro com seu cadastro, por favor verifique todos os campos');
             $this->adicionarMensagemErro($ex->getMessage());
             return $this->renderizar('cadastro', array('usuario' => $d));
         }
         $this->mailer->enviaEmail(array('Usuário' => $d->getEmail(), 'Senha' => $_POST['senha'], 'nome' => $d->getNome()), $d->getEmail(), 'Seja bem vindo(a) ' . $d->getNome(), 'email_pos_cadastro');
         return $this->redirect('cadastro-sucesso/');
     }
     return $this->redirect('home');
 }
开发者ID:umbernardo,项目名称:banco_projetos,代码行数:19,代码来源:SiteController.php


注:本文中的UserHelper::generateRandomPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。