Merge pull request #399 from ajmedway/master

Always create flash messages, allow `enableFlashMessages` only to dictate display (#391)
This commit is contained in:
Lorenzo Milesi
2022-08-11 09:53:26 +02:00
committed by GitHub
3 changed files with 8 additions and 7 deletions

View File

@ -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 still work without issues on 5.6, from now on testing and development will
look forward and manitain only >=7.4 versions. 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: update welcome and confirmation email ending line (maxxer)
- Ehn #361: Record and manage user session history (maranqz) - Ehn #361: Record and manage user session history (maranqz)
- Fix: replace non-working travis build with working github actions build (TonisOrmisson) - 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 #448: Remove deprecated SwiftMailer, use SymfonyMailer instead (TonisOrmisson)
- Ehn #428: Translations of the placeholders in the login widget (anapaulaxenon) - Ehn #428: Translations of the placeholders in the login widget (anapaulaxenon)
- Update PHP-CS-Fixer configuration to new version (maxxer) - 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 ## 1.5.1 April 5, 2020

View File

@ -41,12 +41,10 @@ class PasswordRecoveryService implements ServiceInterface
public function run() public function run()
{ {
try { try {
if ($this->getModule()->enableFlashMessages == true) {
Yii::$app->session->setFlash( Yii::$app->session->setFlash(
'info', '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::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 */ /** @var User $user */
$user = $this->query->whereEmail($this->email)->one(); $user = $this->query->whereEmail($this->email)->one();

View File

@ -76,7 +76,7 @@ class UserCreateService implements ServiceInterface
['email' => $model->email] ['email' => $model->email]
); );
// from web display a flash message (if enabled) // 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( Yii::$app->session->setFlash(
'warning', 'warning',
$error_msg $error_msg