简体   繁体   中英

Rails 5.1.4 and Devise lockable is not displaying error messages

I am using :lockable from Devise,

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)
  2. My app is just displays "Invalid Username or password." flash message, even if the user is already locked. I am expecting the message to be "Your account is locked." which is in the devise.en.yml file as the default

I may be missing something, any help is appreciated. Thanks!


Below is my Gemfile snippet:

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.

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
devise is v4.4.1
devise_ldap_authenticatable is v 0.8.6
devise_security_extension is v0.10.0


UPDATE
May have something to do with the devise 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.
Will just use the failed_attempts column and update the value accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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