Skip to content

Commit

Permalink
Merge pull request #3808 from Shopify/cleanup-webauthn-concern
Browse files Browse the repository at this point in the history
Reference UserWebauthnMethods into UserMultifactorMethods [3/4]
  • Loading branch information
jenshenny authored May 19, 2023
2 parents d872189 + 4bfbf57 commit 0d0a5fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions app/models/concerns/user_multifactor_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module UserMultifactorMethods

included do
include UserTotpMethods
include UserWebauthnMethods

enum mfa_level: { disabled: 0, ui_only: 1, ui_and_api: 2, ui_and_gem_signin: 3 }, _prefix: :mfa

Expand Down Expand Up @@ -62,10 +63,6 @@ def mfa_required?

rubygems.mfa_required.any?
end

def verify_webauthn_otp(otp)
webauthn_verification&.verify_otp(otp)
end
end

class_methods do
Expand Down
6 changes: 6 additions & 0 deletions app/models/concerns/user_webauthn_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ def refresh_webauthn_verification
user_id: id
)
end

private

def verify_webauthn_otp(otp)
webauthn_verification&.verify_otp(otp)
end
end
1 change: 0 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class User < ApplicationRecord
include UserMultifactorMethods
include UserWebauthnMethods
include Clearance::User
include Gravtastic
is_gravtastic default: "retro"
Expand Down

0 comments on commit 0d0a5fe

Please sign in to comment.