Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flash messages after redirection #123

Open
pjam opened this issue Oct 14, 2016 · 2 comments
Open

Flash messages after redirection #123

pjam opened this issue Oct 14, 2016 · 2 comments

Comments

@pjam
Copy link

pjam commented Oct 14, 2016

Hi.

In my app, after a user changes his password, I redirect him to his profile form page. Doing so, the flash message with the password change success is getting eaten in the way, as it does not show.

@garak
Copy link
Member

garak commented Oct 15, 2016

How do you perform the redirect?

@pjam
Copy link
Author

pjam commented Oct 16, 2016

I use a listener for the CHANGE_PASSWORD_SUCCESS event setting the response with a RedirectResponse for the profile route.
I found out that the flashes get lost after
$result = $this->controller->editAction($this->getRequest());
in the edit method of the Profile Manager.

My workaround is saving the existing flashes before that call:
$flashes = $this->getRequest()->getSession()->getFlashBag()->all();

and then setting them back afterwards with
$this->getRequest()->getSession()->getFlashBag()->setAll($flashes);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants