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


PHP User::isPasswordResetTokenValid方法代碼示例

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


在下文中一共展示了User::isPasswordResetTokenValid方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
             //print_r($response); exit(0);
             return $response;
         }
     }
     return false;
 }
開發者ID:sintret,項目名稱:yii2-basic,代碼行數:29,代碼來源:PasswordResetRequestForm.php

示例2: sendEmail

 /**
  * Sends an email with a link, for email confirmation.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail($user)
 {
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['html' => 'emailConfirmationToken-html', 'text' => 'emailConfirmationToken-text'], ['user' => $user])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name])->setTo($this->email)->setSubject('Confirmar registo no ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:afernandes465,項目名稱:memoboard,代碼行數:17,代碼來源:SignupForm.php

示例3: 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('@app/mail/reset-password', ['user' => $user, 'supportEmail' => \Yii::$app->params['supportEmail']])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name])->setTo($this->email)->setSubject('Password reset for ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:shinzero999,項目名稱:Eveda-yii,代碼行數: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(false)) {
             return Yii::$app->mailer->compose('passwordResetToken', ['user' => $user])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name])->setTo($this->email)->setSubject(Yii::t("app/passwordReset", "Password reset for {appName}", ['appName' => Yii::$app->name, 'dot' => false]))->send();
         }
     }
     return false;
 }
開發者ID:pavlinter,項目名稱:yii2-adm-app,代碼行數: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(['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:eibenm,項目名稱:raptorapp,代碼行數: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::findByUsername($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['emailFrom'] => \Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Восстановление пароля ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:nicdnepr,項目名稱:skidos,代碼行數: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::find()->where(['status' => User::STATUS_ACTIVE, 'email' => $this->email])->one();
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose('passwordResetToken', ['model' => $user, 'password' => $this->password])->setFrom(\Yii::$app->params['adminEmail'])->setTo($this->email)->setSubject('Сброс пароля на сайте')->send();
         }
     }
     return false;
 }
開發者ID:Shekhovtsovy,項目名稱:yii2-start-auth-app,代碼行數:18,代碼來源:PasswordResetForm.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-html', 'text' => 'password-reset-token-text'], ['user' => $user, 'resetLink' => Yii::$app->urlManager->createAbsoluteUrl(['profile/reset-password', 'token' => $user->password_reset_token])])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Password reset for ' . Yii::$app->name)->send();
         }
     }
     return false;
 }
開發者ID:starcode-solutions,項目名稱:star-tracker,代碼行數: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(['email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             $resetLink = "http://172.16.134.31/basic/web/index.php?r=user/reset-password&token=" . $user->password_reset_token;
             return \Yii::$app->mailer->compose()->setTo($this->email)->setSubject('Password reset for ' . \Yii::$app->name)->setHtmlBody('<br>尊敬的用戶:' . $user->username . '<br>點擊此鏈接修改密碼:<a href="' . $resetLink . '">' . $resetLink . '</a>')->send();
         }
     }
     return false;
 }
開發者ID:Ethennoob,項目名稱:basic,代碼行數:20,代碼來源:FindpwdForm.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('Reiniciar contraseña al usuario ' . \Yii::$app->name)->send();
         }
     } else {
         //Si no existe el correo
         Yii::$app->session->setFlash('error', 'Lo siento, El correo electrónico proporcionado no esta en nuestra base de datos.');
     }
     return false;
 }
開發者ID:josterricardo,項目名稱:ProyectoMilan,代碼行數:22,代碼來源:PasswordResetRequestForm.php


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