Merge pull request #280 from bscheshirwork/docs-overrriding-controller-add-flash
Add set flash to example for more complex view
This commit is contained in:
@ -20,6 +20,7 @@ Please, before you override a controller's action, make sure that it won't be en
|
|||||||
'on ' . \Da\User\Event\ResetPasswordEvent::EVENT_AFTER_RESET => function (\Da\User\Event\ResetPasswordEvent $event) {
|
'on ' . \Da\User\Event\ResetPasswordEvent::EVENT_AFTER_RESET => function (\Da\User\Event\ResetPasswordEvent $event) {
|
||||||
if ($event->token->user ?? false) {
|
if ($event->token->user ?? false) {
|
||||||
\Yii::$app->user->login($event->token->user);
|
\Yii::$app->user->login($event->token->user);
|
||||||
|
\Yii::$app->session->setFlash('success', Yii::t('usuario', 'Password has been changed'));
|
||||||
}
|
}
|
||||||
\Yii::$app->controller->redirect(\Yii::$app->getUser()->getReturnUrl());
|
\Yii::$app->controller->redirect(\Yii::$app->getUser()->getReturnUrl());
|
||||||
\Yii::$app->end();
|
\Yii::$app->end();
|
||||||
@ -32,6 +33,7 @@ Please, before you override a controller's action, make sure that it won't be en
|
|||||||
\Yii::$app->end();
|
\Yii::$app->end();
|
||||||
},
|
},
|
||||||
'on ' . \Da\User\Event\FormEvent::EVENT_AFTER_RESEND => function (\Da\User\Event\FormEvent $event) {
|
'on ' . \Da\User\Event\FormEvent::EVENT_AFTER_RESEND => function (\Da\User\Event\FormEvent $event) {
|
||||||
|
\Yii::$app->session->setFlash('info', Yii::t('usuario', 'A message has been sent to your email address. It contains a confirmation link that you must click to complete registration.'));
|
||||||
\Yii::$app->controller->redirect(['/user/security/login']);
|
\Yii::$app->controller->redirect(['/user/security/login']);
|
||||||
\Yii::$app->end();
|
\Yii::$app->end();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user