Add BrowserDetection model concern (#29513)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user