Always show a feedback when recovering password (#249)

Even if email doesn't exist
This commit is contained in:
bscheshirwork
2018-10-23 13:10:33 +03:00
committed by Lorenzo Milesi
parent eaa6bf967f
commit adf9321db8
29 changed files with 81 additions and 48 deletions

View File

@ -41,6 +41,13 @@ class PasswordRecoveryService implements ServiceInterface
public function run()
{
try {
if ($this->getModule()->enableFlashMessages == true) {
Yii::$app->session->setFlash(
'info',
Yii::t('usuario', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.', ['email' => $this->email, 'appName' => Yii::$app->name])
);
}
/** @var User $user */
$user = $this->query->whereEmail($this->email)->one();
@ -60,13 +67,6 @@ class PasswordRecoveryService implements ServiceInterface
return false;
}
if ($this->getModule()->enableFlashMessages == true) {
Yii::$app->session->setFlash(
'info',
Yii::t('usuario', 'An email has been sent with instructions for resetting your password')
);
}
return true;
} catch (Exception $e) {
Yii::error($e->getMessage(), 'usuario');