plataformatec/devise — Issue #1464: Automatically logout on password change failed via ajax
Author: naveedtariq
Created: 2011-11-25 15:21:50+00:00
State: open

I saw the other issue that mentions logging out of users on password change. I am facing a similar issue but only when password change fails also I am using AJAX if that matters. I added :bypass => true to sign_in(@user, :bypass => true). If the password change is successful I doesn't sign_out the user but if it fails it signs out. I have tested with the following scenariors

1. current_password empty, both password and password_confirmation provided and matching and valid, resulting in user being signed_out
2. current_password correct and valid, password and passwor_confirmation provided but not matching, resulting in user being signed_out
3. current_password correct and valid, password and password_confirmation both not provided, does not sign out the user.
4. current_password correct and valid, password and password_confirmation both provided and matching, does not sign out the user.

@artist = current_artist
@artist.update_with_password(params[:artist])
sign_in(@artist, :bypass => true)