devise_security_extension:安装命令不工作

devise_security_extension :install command not working

rails 4.2.1.rc4,设计3.5.1,设计uid 0.1.1,devise_security_extension0.9.2

生成器以 "insert config/initializers/devise.rb" 结束并安装语言环境文件,但是 devise.rb 中没有添加新信息,也没有 devise_security_extensions.rb 文件。

有解决办法吗?还是手动安装?

生成 rails generate devise_security_extension:install 后,它会在 devise.rb 文件中创建一些安全输入 -

Devise.setup do |config|
  # ==> Security Extension
  # Configure security extension for devise

  # Should the password expire (e.g 3.months)
  # config.expire_password_after = 3.months

  # Need 1 char of A-Z, a-z and 0-9
  # config.password_regex = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/

  # How often save old passwords in archive
  # config.password_archiving_count = 5

  # Deny old password (true, false, count)
  # config.deny_old_passwords = true

  # captcha integration for recover form
  # config.captcha_for_recover = true

  # captcha integration for sign up form
  # config.captcha_for_sign_up = true

  # captcha integration for sign in form
  # config.captcha_for_sign_in = true

  # captcha integration for unlock form
  # config.captcha_for_unlock = true

  # security_question integration for recover form
  # this automatically enables captchas (captcha_for_recover, as fallback)
  # config.security_question_for_recover = false

  # security_question integration for unlock form
  # this automatically enables captchas (captcha_for_unlock, as fallback)
  # config.security_question_for_unlock = false

  # security_question integration for confirmation form
  # this automatically enables captchas (captcha_for_confirmation, as fallback)
  # config.security_question_for_confirmation = false

  # ==> Configuration for :expirable
  # Time period for account expiry from last_activity_at
  # config.expire_after = 90.days
end

更多安全更改,请参阅https://github.com/phatworx/devise_security_extension

因此 :install 命令实际上正在运行并安装引擎。我将 devise_security_extension.rb 代码插入到 devise.rb 中并配置了我想要的方式,它正在运行。

我发现如果您修改了 devise.rb 文件然后尝试安装 devise_security_extension 它不会注入其代码。