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

Non compatible with Turbo #218

Open
jakemumu opened this issue Nov 27, 2021 · 3 comments
Open

Non compatible with Turbo #218

jakemumu opened this issue Nov 27, 2021 · 3 comments

Comments

@jakemumu
Copy link

Turbo requires redirects on form submissions, or in the case on render :new when login fails, the status on unprocessable_entity as the response code.

Is it possible to update this in this gem?

@jarednorman
Copy link
Member

Can you explain a little more what needs to be changed to support Turbo? Is it default devise behaviour or custom stuff in this extension that might need to be updated to add support?

@jakemumu
Copy link
Author

jakemumu commented Dec 2, 2021

Apologies I really need to turn notifications on here -- sure, so basically, when Turbo is enabled and a form is submitted, the form needs to redirect or else Turbo won't re-render the page, there is a lot of information about it over the Hotwire GitHub.

The quick patch is to just change a couple methods in the user controllers:

When things are successful the controllers redirect and are fine, but currently when a failure happens: render :new is called, simply changing this to render :new, status: :unprocessable_entity fixes compatibility with Turbo.

That's in both the user sessions controller, and the user registrations controller.

@jakemumu
Copy link
Author

jakemumu commented Dec 2, 2021

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

No branches or pull requests

2 participants