我目前正在使用devise身份验证开发Rails应用。我需要为重置密码禁用令牌过期。根据Devise Documentation on Recoverable,没有配置可以做到这一点。我认为使此工作有效的唯一方法是重写Recoverable和reset_password_period_valid?
函数始终返回true。但是我不确定是否是最佳/正确的解决方案。
当前关于我的devise.rb,我有:
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [ :email ]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 2.hours
例如,您可以将其设置为10年,就像禁用令牌过期一样。