简体   繁体   English

Rails 5.1.4和可锁定的Devise不显示错误消息

[英]Rails 5.1.4 and Devise lockable is not displaying error messages

I am using :lockable from Devise, 我正在使用Devise的:lockable lockable

The problem I am encountering are these two: 我遇到的问题是以下两个:

  1. The last_attempt warning message is never displayed (I am expecting the message to be "You have one more attempt before your account is locked." which is in the devise.en.yml file as the default) last_attempt警告消息永远不会显示(我希望该消息是"You have one more attempt before your account is locked."默认情况下,它位于devise.en.yml文件中)
  2. My app is just displays "Invalid Username or password." 我的应用仅显示"Invalid Username or password." flash message, even if the user is already locked. Flash消息,即使用户已被锁定。 I am expecting the message to be "Your account is locked." 我希望该消息是"Your account is locked." which is in the devise.en.yml file as the default 默认情况下,它位于devise.en.yml文件中

I may be missing something, any help is appreciated. 我可能会缺少一些东西,感谢您的帮助。 Thanks! 谢谢!


Below is my Gemfile snippet: 以下是我的Gemfile代码段:

gem 'devise'
gem "devise_ldap_authenticatable", git: "git://github.com/cschiewek/devise_ldap_authenticatable.git"
gem 'devise_security_extension', git: 'https://github.com/phatworx/devise_security_extension.git', branch: 'master'

I am using the devise_security_extension only for its :session_limitable module. 我仅将devise_security_extension用于其:session_limitable模块。

Here is my user model snippet: 这是我的用户模型片段:

devise :ldap_authenticatable, :registerable, :session_limitable, :timeoutable, :lockable, :trackable, :validatable, authentication_keys: [:username]

And here is my devise config snippet: 这是我的设计配置片段:

config.lock_strategy = :failed_attempts
config.unlock_strategy = :none
config.maximum_attempts = 3
config.last_attempt_warning = true

My flash message displayer: 我的即时消息显示器:

- flash.each do |key, value|
  - next if key == "timedout"
  %div{ class: flash_class(key) }
    %button.close{ "aria-hidden": "true", "data-dismiss": "alert", type: "button" } ×
    = value

rails is v5.1.4 rails是v5.1.4
devise is v4.4.1 设计是v4.4.1
devise_ldap_authenticatable is v 0.8.6 devise_ldap_authenticatable是v 0.8.6
devise_security_extension is v0.10.0 devise_security_extension为v0.10.0


UPDATE 更新
May have something to do with the devise LDAP gem: https://github.com/cschiewek/devise_ldap_authenticatable/issues/78 可能与设计LDAP gem有关: https : //github.com/cschiewek/devise_ldap_authenticatable/issues/78
will look into it more 会进一步研究

Since in the discussion from https://github.com/cschiewek/devise_ldap_authenticatable/issues/78 states that this should be talked/confirmed with the Active Directory side, I will just have to implement my own simple account locking/unlocking. 由于在https://github.com/cschiewek/devise_ldap_authenticatable/issues/78的讨论中指出,应该与Active Directory进行讨论/确认,因此我只需要实现自己的简单帐户锁定/解锁即可。
Will just use the failed_attempts column and update the value accordingly. 将只使用failed_attempts列并相应地更新值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM