diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc0aee..a556cab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ compatibility, leaving behind obsolete versions. While yii2-usuario should still work without issues on 5.6, from now on testing and development will look forward and manitain only >=7.4 versions. +There's a change in flash messages handling, please see #391 + - Ehn: update welcome and confirmation email ending line (maxxer) - Ehn #361: Record and manage user session history (maranqz) - Fix: replace non-working travis build with working github actions build (TonisOrmisson) @@ -24,6 +26,7 @@ look forward and manitain only >=7.4 versions. - Ehn #448: Remove deprecated SwiftMailer, use SymfonyMailer instead (TonisOrmisson) - Ehn #428: Translations of the placeholders in the login widget (anapaulaxenon) - Update PHP-CS-Fixer configuration to new version (maxxer) +- Fix #391: Always create flash messages, allow `enableFlashMessages` only to dictate display (ajmedway) ## 1.5.1 April 5, 2020 diff --git a/src/User/Service/PasswordRecoveryService.php b/src/User/Service/PasswordRecoveryService.php index 9d6e2db..0e5b597 100644 --- a/src/User/Service/PasswordRecoveryService.php +++ b/src/User/Service/PasswordRecoveryService.php @@ -41,12 +41,10 @@ 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]) - ); - } + 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(); diff --git a/src/User/Service/UserCreateService.php b/src/User/Service/UserCreateService.php index 5dc41ac..5c1cfde 100644 --- a/src/User/Service/UserCreateService.php +++ b/src/User/Service/UserCreateService.php @@ -76,7 +76,7 @@ class UserCreateService implements ServiceInterface ['email' => $model->email] ); // from web display a flash message (if enabled) - if ($this->getModule()->enableFlashMessages === true && is_a(Yii::$app, "yii\web\Application")) { + if ($this->getModule()->enableFlashMessages === true && is_a(Yii::$app, yii\web\Application::class)) { Yii::$app->session->setFlash( 'warning', $error_msg