2015-07-04 66 views

回答

3

Warden将用户标识和加密密码存储在用户cookie中并对其进行签名。这意味着改变他们的密码会将他们签出。

请注意,如果你复制他们的加密密码,并把它放回去以后,他们仍然有饼干,他们会回来的什么也没有发生。

如果无法更改密码,恐怕你不能没有一些魔法做到这一点(如放一段代码,只会在他们的用户ID运行并记录出来)。

0

假设您已经部署了一些关键修复程序并需要注销所有用户,您可以在application_controller.rb中添加一些黑魔法,但请确保PM没有看到它,因为他会烧着你;

before_action logout_users, if: :user_signed_in? 

def logout_users 
    expire_date = DateTime.strptime(last_deploy_time) 
    sign_out current_user if current_user.current_sign_in_at < expire_date 
end 
1

我发现,刚刚更新的密码将退出帐户用户。

user = User.find <x> 
user.password = "<new password>" 
user.save 

在刷新页面时,您会看到用户已注销。如果您要将其设置为之前的状态,用户仍会保持注销状态。