Devise正在密码更改后注销用户 [英] Devise is logging out users after a password change

查看:124
本文介绍了Devise正在密码更改后注销用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用devise,当用户更改密码时,网站会将其注销。我在线阅读,添加sign_in将会做的伎俩,但不工作,用户在密码更改时会被注销。这是我的代码

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

推荐答案

我通常会这些说明和它的工作。也许你应该做

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

sign_in(@user, :bypass => true)

而不是

sign_in(current_user, :bypass => true)

这篇关于Devise正在密码更改后注销用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆