【问题标题】:Rails - Devise - Disable Reset Password Token expiration timeRails - 设计 - 禁用重置密码令牌到期时间
【发布时间】:2020-06-03 03:08:20
【问题描述】:

我目前正在开发带有设计身份验证的 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】:

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

    【讨论】:

    • 是的,我建议这样做,但我使用devise-invitable gem 找到了更好的解决方案。
    猜你喜欢
    • 2018-03-31
    • 2023-03-04
    • 1970-01-01
    • 2017-05-09
    • 2016-02-22
    • 2017-01-25
    • 2011-08-19
    • 2014-01-27
    • 1970-01-01
    相关资源
    最近更新 更多