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

[1.x] Improve SPA compatibility #29

Merged
merged 1 commit into from
Dec 18, 2020

Conversation

y0rdie
Copy link

@y0rdie y0rdie commented Dec 16, 2020

Just some very minor changes to make the package more SPA compatible out the box:

  1. Be explicit with the authentication guard otherwise a SPA will attempt to use the RequestGuard and fail.
  2. Throw a ValidationException if the confirmed password is invalid.

There's of course many ways to implement both points, I've gone with the least amount of change, however:

  1. We could type hint the StatefulGuard in the constructor like Fortify's AuthenticatedSessionController and ConfirmablePasswordController.
  2. We could wrap the exception in an if ($request->wantsJson()) { conditional and keep the back() redirect for server rendered apps, again like Fortify's FailedPasswordConfirmationResponse.

Happy to change this request to your preferred implementation if acceptable.

Thanks for your time,
Sam

@taylorotwell taylorotwell merged commit 4263e3d into laravel:1.x Dec 18, 2020
@y0rdie
Copy link
Author

y0rdie commented Dec 18, 2020

Sweet thanks ☺️

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

Successfully merging this pull request may close these issues.

2 participants