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:
Martin Brennan
2019-12-17 10:33:51 +10:00
committed by GitHub
parent 84ede5867c
commit beb91e7eff
9 changed files with 21 additions and 10 deletions

View File

@ -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