Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/authentication_event.rb')
-rw-r--r--app/models/authentication_event.rb5
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