使用remember me选项签出用户时,设计使用record = nil调用的before_logout挂钩

时间:2021-03-15 18:04:14

I'm using Devise 2.0.4 (with devise-neo4j), Warden 1.1.1, Rails 3.2.3.
When I sign in without remember me option checked, I can sign out without a problem.
However when I sign in using remember me option I cannot sign out.
Digging in the code I found out that the before_logout hook present in devise-2.0.4/lib/devise/hooks/forgetable.rb (Warden::Manager.before_logout do |record, warden, options|) is called with record => nil.
I'm not sure whether it's Devise bug, Warden's or mine…

我正在使用Devise 2.0.4(使用devise-neo4j),Warden 1.1.1,Rails 3.2.3。当我在没有记住选中的情况下登录选项时,我可以毫无问题地退出。但是,当我使用“记住我”选项登录时,我无法退出。挖掘代码我发现在devise-2.0.4 / lib / devise / hooks / forgetable.rb(Warden :: Manager.before_logout do | record,warden,options |)中出现的before_logout挂钩用record =>调用零。我不确定它是Devise bug,Warden还是我的......

The stacktrace is as follows:

堆栈跟踪如下:

devise-2.0.4/lib/devise/hooks/forgetable.rb:7:in `(root)'
org/jruby/RubyProc.java:258:in `call'
warden-1.1.1/lib/warden/hooks.rb:14:in `_run_callbacks'
org/jruby/RubyArray.java:1615:in `each'
warden-1.1.1/lib/warden/hooks.rb:9:in `_run_callbacks'
warden-1.1.1/lib/warden/manager.rb:53:in `_run_callbacks'
warden-1.1.1/lib/warden/proxy.rb:243:in `logout'
org/jruby/RubyArray.java:1615:in `each'
warden-1.1.1/lib/warden/proxy.rb:241:in `logout'
devise-2.0.4/lib/devise/controllers/helpers.rb:159:in `sign_out_all_scopes'
devise-2.0.4/lib/devise/controllers/helpers.rb:139:in `sign_out'
devise-2.0.4/app/controllers/devise/sessions_controller.rb:23:in `destroy'

1 个解决方案

#1


-1  

The issue was connected with Torquebox and session store configuration (config/initializers/session_store.rb). The issue happens when using a default Rails configuration or with Torquebox one commented out (for some reason).

该问题与Torquebox和会话存储配置(config / initializers / session_store.rb)有关。使用默认Rails配置或Torquebox注释掉(由于某种原因)时会出现问题。

#1


-1  

The issue was connected with Torquebox and session store configuration (config/initializers/session_store.rb). The issue happens when using a default Rails configuration or with Torquebox one commented out (for some reason).

该问题与Torquebox和会话存储配置(config / initializers / session_store.rb)有关。使用默认Rails配置或Torquebox注释掉(由于某种原因)时会出现问题。