Devise is logging out users after a password change
Asked Answered
I

1

5

I am using devise and when a user changes a password the site logs them out. I read online that adding the sign_in will do the trick but not working and the user gets logged out when a password change. Here is my code

if @user.errors[:base].empty? and @user.update_attributes(params[:user])
  sign_in(current_user, :bypass => true)
  flash[:success] = "User account has been successfully updated"
  redirect_to edit_user_path(params[:site_id], @user)
else
  render :action => :edit, :status => :unprocessable_entity
end

I was assuming that this would work but regardless of what i do i still get logged out....anything missing or maybe one devise setting is off...any help would be appreciated

Integrand answered 19/7, 2012 at 19:13 Comment(0)
F
13

I usually folow these instructions and it works. Maybe you should do

sign_in(@user, :bypass => true)

instead of

sign_in(current_user, :bypass => true)
Faruq answered 19/7, 2012 at 19:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.