Whenever a user updates their password, it signs the user out and asks them to sign in again. This is my action
users_controller.rb
def update
@user = User.find(params[:id])
if @user.update user_params
sign_in @user, bypass: true # for some reason Devise signs the user out
redirect_to @user
http://www.rubydoc.info/github/plataformatec/devise/Devise/Controllers/SignInOut#sign_in-instance_method
I tried sign_in @user
, also, but that didn't work. I tried it without sign_in
but that didn't work either. I saw this answer, but it doesn't help: Devise is logging out users after a password change. Updating the user without the password is working OK. (There is some code not shown.)
Devise 3.4.1.
I had to add a 'scope`. This worked.
sign_in :user, @user, bypass: true # for some reason Devise signs the user out
See answer here: https://stackoverflow.com/a/11589286/148844
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With