2
0

Add BrowserDetection model concern (#29513)

This commit is contained in:
Matt Jankowski
2024-03-19 11:39:14 -04:00
committed by GitHub
parent d7ab5655ef
commit 62e266fbd6
3 changed files with 31 additions and 29 deletions

View File

@@ -16,21 +16,11 @@
#
class LoginActivity < ApplicationRecord
include BrowserDetection
enum :authentication_method, { password: 'password', otp: 'otp', webauthn: 'webauthn', sign_in_token: 'sign_in_token', omniauth: 'omniauth' }
belongs_to :user
validates :authentication_method, inclusion: { in: authentication_methods.keys }
def detection
@detection ||= Browser.new(user_agent)
end
def browser
detection.id
end
def platform
detection.platform.id
end
end