Sha256: 2be9aec90c048cc23e0cbf2c52f88b985e6f679aae8758e2b988752fd92dd54f

Contents?: true

Size: 741 Bytes

Versions: 7

Compression:

Stored size: 741 Bytes

Contents

# using current version https://github.com/plataformatec/devise/blob/e841c4c5ef826b6838b269d259170bb4fbca82f1/lib/devise/hooks/lockable.rb
# as 3-stable version https://github.com/plataformatec/devise/blob/3-stable/lib/devise/hooks/lockable.rb
# is using update_attribute which is not supported by Her
# After each sign in, if resource responds to failed_attempts, sets it to 0
# This is only triggered when the user is explicitly set (with set_user)
Warden::Manager.after_set_user except: :fetch do |record, warden, options|
  if record.respond_to?(:failed_attempts) && warden.authenticated?(options[:scope])
    unless record.failed_attempts.to_i.zero?
      record.failed_attempts = 0
      record.save(validate: false)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mno-enterprise-core-3.4.0 lib/devise/hooks/lockable.rb
mno-enterprise-core-3.3.3 lib/devise/hooks/lockable.rb
mno-enterprise-core-3.3.2 lib/devise/hooks/lockable.rb
mno-enterprise-core-3.2.1 lib/devise/hooks/lockable.rb
mno-enterprise-core-3.3.1 lib/devise/hooks/lockable.rb
mno-enterprise-core-3.3.0 lib/devise/hooks/lockable.rb
mno-enterprise-core-3.2.0 lib/devise/hooks/lockable.rb