设计记住我和会话 [英] Devise Remember Me and Sessions

查看:85
本文介绍了设计记住我和会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对设计宝石配置设置感到困惑:

I'm confused with the devise gem config settings:

  # The time the user will be remembered without asking for credentials again.
  config.remember_for = 2.weeks

  # The time you want to timeout the user session without activity. After this
  # time the user will be asked for credentials again.
  config.timeout_in = 10.minutes

我想让用户选择记住我复选框(即保持登录状态),但默认会话超时为10分钟。 10分钟后,即使我点击了记住我,也要求我再次登录。如果这是真的,那么remember_for真的没有意义。显然我在这里缺少一些东西。

I want to have a user select the "Remember Me" checkbox (i.e., keep me logged in), but the default session timeout is 10 minutes. After 10 minutes it asks me to log in again even though I have clicked "Remember me". If this is true then the remember_for is really meaningless. Obviously I'm missing something here.

推荐答案

timeout_in 将自动在不活动的10分钟内登出,并与 remember_me 复选框不兼容。您可以有一个,但不能同时使用。

The timeout_in will automatically log you out within 10 minutes of inactivity and is incompatible with the remember_me checkbox. You can have one, but not both.

这篇关于设计记住我和会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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