devise icon indicating copy to clipboard operation
devise copied to clipboard

Login email flow should keep email on fail

Open ConfusedVorlon opened this issue 3 years ago • 1 comments

Environment

  • Ruby 3.1.2
  • Rails 7.0.2.2
  • Devise 4.8.1

Current behavior

email/password login

  1. user types in email & password (password is wrong)
  2. user clicks login
  3. site shows warning message 'Invalid Email or password.'
  4. 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)

ConfusedVorlon avatar May 31 '22 17:05 ConfusedVorlon

I still haven't managed to solve this myself. Keen to hear if anyone has a work around.

vasaf avatar Jul 01 '22 01:07 vasaf

@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.

carlosantoniodasilva avatar Feb 20 '23 13:02 carlosantoniodasilva