Beispiel #1
0
 /**
  * Sends an email with a link, for confirm the email
  *
  * @return boolean
  */
 public function sendEmail()
 {
     if (!User::isTokenValid($this->user->email_confirm_token)) {
         $this->user->generateEmailConfirmToken();
         $this->user->updateAttributes(['email_confirm_token' => $this->user->email_confirm_token, 'date_confirm' => $this->user->date_confirm]);
     }
     return Yii::$app->notify->sendMessage($this->email, Yii::t('app', 'Activate Your Account'), 'emailConfirmToken', ['user' => $this->user]);
 }
 /**
  * Sends an email with a link, for resetting the password
  *
  * @return boolean
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findByEmail($this->email);
     if ($user) {
         if (!User::isTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save(false)) {
             return Yii::$app->notify->sendMessage($this->email, Yii::t('app', 'Password Reset'), 'passwordResetToken', ['user' => $user]);
         }
         // @codeCoverageIgnore
     }
     // @codeCoverageIgnore
     return false;
 }