當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。