Class: AuthenticationEvent
Constant Summary
collapse
- TWO_FACTOR =
'two-factor'
- TWO_FACTOR_U2F =
'two-factor-via-u2f-device'
- TWO_FACTOR_WEBAUTHN =
'two-factor-via-webauthn-device'
- STANDARD =
'standard'
- STATIC_PROVIDERS =
[TWO_FACTOR, TWO_FACTOR_U2F, TWO_FACTOR_WEBAUTHN, STANDARD].freeze
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Class Method Summary
collapse
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Class Method Details
.initial_login_or_known_ip_address?(user, ip_address) ⇒ Boolean
29
30
31
32
|
# File 'app/models/authentication_event.rb', line 29
def self.initial_login_or_known_ip_address?(user, ip_address)
!where(user_id: user).exists? ||
where(user_id: user, ip_address: ip_address).success.exists?
end
|
.most_used_ip_address_for_user(user) ⇒ Object
34
35
36
|
# File 'app/models/authentication_event.rb', line 34
def self.most_used_ip_address_for_user(user)
select('mode() within group (order by ip_address) as ip_address').find_by(user: user).ip_address
end
|
.providers ⇒ Object
25
26
27
|
# File 'app/models/authentication_event.rb', line 25
def self.providers
STATIC_PROVIDERS | Devise.omniauth_providers.map(&:to_s)
end
|