mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 00:37:44 +08:00
FIX: require: false for rotp gem (#8540)
The ROTP gem is only used in a very small amount of places in the app, we don't need to globally require it. Also set the Addressable gem to not have a specific version range, as it has not been a problem yet. Some slight refactoring of UserSecondFactor here too to use SecondFactorManager to avoid code repetition
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserSecondFactor < ActiveRecord::Base
|
||||
include SecondFactorManager
|
||||
belongs_to :user
|
||||
|
||||
scope :backup_codes, -> do
|
||||
@ -22,12 +23,12 @@ class UserSecondFactor < ActiveRecord::Base
|
||||
)
|
||||
end
|
||||
|
||||
def get_totp_object
|
||||
ROTP::TOTP.new(self.data, issuer: SiteSetting.title)
|
||||
def totp_object
|
||||
get_totp_object(self.data)
|
||||
end
|
||||
|
||||
def totp_provisioning_uri
|
||||
get_totp_object.provisioning_uri(user.email)
|
||||
totp_object.provisioning_uri(user.email)
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user