Rails-Devise-禁用重设密码令牌到期时间

问题描述 投票:0回答:1

我目前正在使用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
ruby-on-rails ruby devise devise-recoverable
1个回答
0
投票

例如,您可以将其设置为10年,就像禁用令牌过期一样。

© www.soinside.com 2019 - 2024. All rights reserved.