如何使用devise配置超时? [英] How to configure time out using devise?

查看:127
本文介绍了如何使用devise配置超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

型号:

devise :database_authenticatable, :registerable,:timeoutable, :recoverable, :rememberable, :trackable, :validatable,:timeout_in => 10.seconds

development.rb:

development.rb:

config.timeout_in = 10.seconds

devise.rb:

devise.rb:

config.timeout_in = 10.seconds


推荐答案

您是否希望页面刷新并再次显示登录页面?如果是这样,这不是超时功能的工作原理。如果您希望在刷新时向您显示登录页面,请从模型中删除超时部分,并将以下内容放在devise.rb NOT development.rb中。不要忘记重新启动rails服务器。

Are you expecting the page to refresh and show you a login page again? If so, that's not how the timeoutable feature works. If you're expecting it to present you with the login page when you refresh, remove the timeout part from your model and put the following in devise.rb NOT development.rb. Don't forget to restart rails server.

config.timeout_in = 1.hour

这一切都记录在devise wiki中这里< a>

This is all documented in the devise wiki here

此外,我不知道10秒后的逻辑?看起来有点太短如果它仍然不起作用,增加到(例如)五分钟并测试。

Also, I'm not sure about the logic behind 10 seconds?? Seems a little too short. If it's still not working, increase to (for example) five minutes and test.

这篇关于如何使用devise配置超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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