Login email flow should keep email on fail
Environment
- Ruby 3.1.2
- Rails 7.0.2.2
- Devise 4.8.1
Current behavior
email/password login
- user types in email & password (password is wrong)
- user clicks login
- site shows warning message 'Invalid Email or password.'
- email is cleared and has to be re-typed
Expected behavior
email is still present in the form
(any other form, we keep the typed info when there is something equivalent to a validation error)
I still haven't managed to solve this myself. Keen to hear if anyone has a work around.
@ConfusedVorlon @vasaf are you both using Turbo? There have been some custom implementations out there that suggested overriding Devise to redirect after authenticating, which will lose all app context, including the params. Here's one example from someone's app that I helped update: https://github.com/vincemilo/odin-facebook/pull/1/files#diff-cb6e8126296dbc007e7625eee863de5c3213ed949b9999ea3418775f65826531
If Turbo + that redirect is the case here, I recommend upgrading to 4.9.0 which was just recently released to support it, and that should work:
Turbo version (available in devise main / 4.9.0)
https://user-images.githubusercontent.com/26328/220115730-79a4604e-9ed5-42b7-9f44-0deff33fddf8.mp4
Alternatively, the non-Turbo version should work too: (just add data: { turbo: false } to the session form)
https://user-images.githubusercontent.com/26328/220116143-816e2a6c-ad49-4edc-9a9f-85d311e2d28a.mp4
If that is not the case, let me know and we can reopen & investigate some more.