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


PHP User::isPasswordResetTokenValid方法代碼示例

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


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

示例1: sendMail

 public function sendMail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             $setting = Setting::find()->where(['id' => 1])->one();
             $username = $setting->sendgridUsername;
             $password = $setting->sendgridPassword;
             $mail_admin = $setting->emailAdmin;
             $sendgrid = new \SendGrid($username, $password, array("turn_off_ssl_verification" => true));
             $email = new \SendGrid\Email();
             $mail = $user->email;
             //echo $user->email;exit(0);
             $resetLink = \Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]);
             $body_message = 'Hello ' . Html::encode($user->username) . ', <br>
             Follow the link below to reset your password:  <br>
             ' . Html::a(Html::encode($resetLink), $resetLink);
             $email->addTo($user->email)->setFrom($mail_admin)->setSubject('Password reset for ' . \Yii::$app->name)->setHtml($body_message);
             $response = $sendgrid->send($email);
             return $response;
         }
     }
     return false;
 }
開發者ID:sintret,項目名稱:yii2-advanced,代碼行數:28,代碼來源:PasswordResetRequestForm.php

示例2: generateToken

 public function generateToken()
 {
     $mobile = $this->_session['passwordResetMobile'];
     $this->_user = User::findByMobile($mobile);
     if (!User::isPasswordResetTokenValid($this->_user->password_reset_token)) {
         $this->_user->generatePasswordResetToken();
     }
     return $this->_user->save(false);
 }
開發者ID:daixianceng,項目名稱:xiaoego.com,代碼行數:9,代碼來源:PasswordResetVerifyForm.php

示例3: sendEmail

 /**
  * Sends an email with a confirmLink, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->passwordResetToken)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom([\Yii::$app->params['email.admin'] => 'Служба технической поддрежки' . \Yii::$app->name])->setTo($this->email)->setSubject(\Yii::$app->name . ': сброс пароля')->send();
         }
     }
     return false;
 }
開發者ID:shubnikofff,項目名稱:teleport,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例4: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom([\Yii::$app->params['supportEmail'] => '湖南鬆齡堂中藥飲片有限公司'])->setTo($this->email)->setSubject('重置密碼' . '湖南鬆齡堂中藥飲片有限公司')->send();
         }
     }
     return false;
 }
開發者ID:weiyiyi,項目名稱:base,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例5: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose('user/passwordResetToken', ['user' => $user])->setFrom([\Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])->setTo($this->email)->setSubject(Module::t('password', 'SUBJECT_RESET_PASSWORD {APP_NAME}', ['APP_NAME' => Yii::$app->name]))->send();
         }
     }
     return false;
 }
開發者ID:grischuk-sasha,項目名稱:friend,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例6: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['recordStatus' => User::RECORDSTATUS_USED, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Password reset for ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:fredyns,項目名稱:yii2-boilerplate,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例7: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose('passwordResetToken', ['user' => $user])->setFrom([\Yii::$app->setting->get('smtpUser') => \Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Password reset for ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:davidfang,項目名稱:getyii,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例8: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['html' => 'password-reset-token'], ['user' => $user])->setFrom([\Yii::$app->params['noreplyEmail'] => \Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Сброс пароля для пользователя ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:KPEMATOP,項目名稱:findspree_old,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例9: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['text' => 'passwordResetToken-text'], ['user' => $user])->setFrom(\Yii::$app->params['adminEmail'])->setTo($this->email)->setSubject('Сброс пароля на сайте')->send();
         }
     }
     return false;
 }
開發者ID:darkffh,項目名稱:yii2-lowbase,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例10: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])->setTo($this->email)->setSubject(Yii::t('msg', 'Password reset for {appName}', ['appName' => Yii::$app->name]))->send();
         }
     }
     return false;
 }
開發者ID:jedzura,項目名稱:nzs,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例11: sendEmail

 /**
  * Отправка письма
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html'], ['user' => $user])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name])->setTo($this->email)->setSubject('Восстановление пароля для сайта "' . \Yii::$app->name . '"')->send();
         }
     }
     return false;
 }
開發者ID:vampir2236,項目名稱:cities.ru,代碼行數:18,代碼來源:PasswordResetRequestForm.php

示例12: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom([Option::get('admin_email') => Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Password reset for ' . Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:writesdown,項目名稱:app-cms,代碼行數:19,代碼來源:PasswordResetRequestForm.php

示例13: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if (!$user) {
         return false;
     }
     if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
         $user->generatePasswordResetToken();
     }
     if (!$user->save()) {
         return false;
     }
     return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom(["flyfame@yeah.net" => "簡揚教育係統郵件"])->setTo($this->email)->setSubject('重置密碼 ' . \Yii::$app->name)->send();
 }
開發者ID:James88,項目名稱:www.yii2.com,代碼行數:20,代碼來源:PasswordResetRequestForm.php

示例14: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail($resetPasswordRoute = null)
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         $route = $resetPasswordRoute ? $resetPasswordRoute : 'site/reset-password';
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user, 'resetRoute' => $route])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Password reset for ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:ninetor,項目名稱:yii-classifield,代碼行數:20,代碼來源:PasswordResetRequestForm.php

示例15: sendEmail

 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             $admin_email = Configurations::find()->where(['key' => 'admin_email'])->one();
             return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom($admin_email->value)->setTo($this->email)->setSubject('Password reset for ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:Junaid-Farid,項目名稱:staylance-new,代碼行數:20,代碼來源:PasswordResetRequestForm.php


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