mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FEATURE: Disallow login via omniauth when user has 2FA enabled.
This commit is contained in:
parent
0fabf80dca
commit
fb75f188ba
7 changed files with 77 additions and 25 deletions
|
@ -114,6 +114,11 @@ class Users::OmniauthCallbacksController < ApplicationController
|
|||
end
|
||||
|
||||
def user_found(user)
|
||||
if user.totp_enabled?
|
||||
@auth_result.omniauth_disallow_totp = true
|
||||
return
|
||||
end
|
||||
|
||||
# automatically activate/unstage any account if a provider marked the email valid
|
||||
if @auth_result.email_valid && @auth_result.email == user.email
|
||||
user.update!(staged: false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue