Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise is logging out users after a password change

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

like image 926
Matt Elhotiby Avatar asked Jul 19 '12 19:07

Matt Elhotiby


1 Answers

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)
like image 184
lisowski.r Avatar answered Sep 22 '22 17:09

lisowski.r