diff --git a/models/RecoveryForm.php b/models/RecoveryForm.php index f5a1b3b38..c0ad5d20c 100644 --- a/models/RecoveryForm.php +++ b/models/RecoveryForm.php @@ -121,14 +121,22 @@ public function sendRecoveryMessage() if (!$this->mailer->sendRecoveryMessage($user, $token)) { return false; } - } - \Yii::$app->session->setFlash( - 'info', - \Yii::t('user', 'An email has been sent with instructions for resetting your password') - ); + \Yii::$app->session->setFlash( + 'info', + \Yii::t('user', 'An email has been sent with instructions for resetting your password') + ); + + return true; + } else { + \Yii::$app->session->setFlash( + 'warning', + \Yii::t('user', 'Email could not been sent.') + ); + + return false; + } - return true; } /** diff --git a/models/ResendForm.php b/models/ResendForm.php index 97e89d936..70dd8e684 100644 --- a/models/ResendForm.php +++ b/models/ResendForm.php @@ -101,15 +101,25 @@ public function resend() ]); $token->save(false); $this->mailer->sendConfirmationMessage($user, $token); + + \Yii::$app->session->setFlash( + 'info', + \Yii::t( + 'user', + 'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.' + ) + ); + } else { + \Yii::$app->session->setFlash( + 'warning', + \Yii::t( + 'user', + 'Could not send message to the given email address. Please register or resend password.' + ) + ); + } - \Yii::$app->session->setFlash( - 'info', - \Yii::t( - 'user', - 'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.' - ) - ); return true; }