Always create flash messages, allow enableFlashMessages only to dictate display
Fixed inconsistent handling of flash messages and the `enableFlashMessages` config setting (#391)
This commit is contained in:
@ -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])
|
||||
);
|
||||
}
|
||||
|
||||
/** @var User $user */
|
||||
$user = $this->query->whereEmail($this->email)->one();
|
||||
|
||||
@ -75,8 +75,8 @@ class UserCreateService implements ServiceInterface
|
||||
'Error sending welcome message to "{email}". Please try again later.',
|
||||
['email' => $model->email]
|
||||
);
|
||||
// from web display a flash message (if enabled)
|
||||
if ($this->getModule()->enableFlashMessages === true && is_a(Yii::$app, yii\web\Application::class)) {
|
||||
// from web generate a flash message
|
||||
if (is_a(Yii::$app, yii\web\Application::class)) {
|
||||
Yii::$app->session->setFlash(
|
||||
'warning',
|
||||
$error_msg
|
||||
|
||||
Reference in New Issue
Block a user