Sha256: 2f6f96ae7f4bc42302c227054d115fae80dd9d8ffaf6bf1f01b1721e047c5519

Contents?: true

Size: 470 Bytes

Versions: 12

Compression:

Stored size: 470 Bytes

Contents

# frozen_string_literal: true

# 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

12 entries across 12 versions & 1 rubygems

Version Path
devise-4.7.3 lib/devise/hooks/lockable.rb
devise-4.7.2 lib/devise/hooks/lockable.rb
devise-4.7.1 lib/devise/hooks/lockable.rb
devise-4.7.0 lib/devise/hooks/lockable.rb
devise-4.6.2 lib/devise/hooks/lockable.rb
devise-4.6.1 lib/devise/hooks/lockable.rb
devise-4.6.0 lib/devise/hooks/lockable.rb
devise-4.5.0 lib/devise/hooks/lockable.rb
devise-4.4.3 lib/devise/hooks/lockable.rb
devise-4.4.2 lib/devise/hooks/lockable.rb
devise-4.4.1 lib/devise/hooks/lockable.rb
devise-4.4.0 lib/devise/hooks/lockable.rb