diff options
Diffstat (limited to 'app/models/authentication_event.rb')
-rw-r--r-- | app/models/authentication_event.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/authentication_event.rb b/app/models/authentication_event.rb index 1e822629ba1..0ed197f32df 100644 --- a/app/models/authentication_event.rb +++ b/app/models/authentication_event.rb @@ -25,4 +25,9 @@ class AuthenticationEvent < ApplicationRecord def self.providers STATIC_PROVIDERS | Devise.omniauth_providers.map(&:to_s) end + + 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 end |