Skip to content

How To: Not auto sign out after user edit profile

Pardeep Dhingra edited this page Aug 21, 2017 · 5 revisions

http://stackoverflow.com/questions/4264750/devise-logging-out-automatically-after-password-change

def update
  if current_user.update_with_password(params[:user_params])
    bypass_sign_in current_user
    redirect_to root_path, notice: "Password updated successfully!"
  else
    redirect_back(fallback_location: root_path, alert: current_user.errors.full_messages.join(" ").html_safe)
  end
end

If you are using several scopes, specify the one you are signing in:

bypass_sign_in @user, scope: :user
Clone this wiki locally