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

[4.x] Use RedirectIfAuthorized middleware on password reset & activate pages #9053

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented Nov 23, 2023

This PR adds the RedirectIfAuthorized middleware to password reset & activate pages, so if a logged in user tries to visit those pages they will be redirected away.

I've also updated RedirectIfAuthorized to check if the user can access the cp or not, if they can they are taken to it, and if they cant they are just taken to the homepage.

I think this closes #2521

@ryanmitchell ryanmitchell changed the title [4.x[ Use RedirectIfAuthorized middleware on password reset & activate pages [4.x] Use RedirectIfAuthorized middleware on password reset & activate pages Nov 23, 2023
- Use guard like in RedirectIfAuthenticated
- Use guard guard clause (ha) so the bulky logic doesnt have to all sit in an conditional
- Apply the flash message to both redirects. Maybe the frontend is using the session:error tag.
@jasonvarga jasonvarga merged commit 952dacb into statamic:4.x Nov 27, 2023
18 checks passed
@ryanmitchell ryanmitchell deleted the fix/redirect-authenticated-users-on-password-reset-pages branch December 2, 2023 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants