mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
FEATURE: Disallow login via omniauth when user has 2FA enabled.
This commit is contained in:
@ -4,7 +4,7 @@ class Auth::Result
|
||||
:awaiting_approval, :authenticated, :authenticator_name,
|
||||
:requires_invite, :not_allowed_from_ip_address,
|
||||
:admin_not_allowed_from_ip_address, :omit_username,
|
||||
:skip_email_validation, :destination_url
|
||||
:skip_email_validation, :destination_url, :omniauth_disallow_totp
|
||||
|
||||
attr_accessor(
|
||||
:failed,
|
||||
@ -42,13 +42,22 @@ class Auth::Result
|
||||
date: I18n.l(user.suspended_till, format: :date_only), reason: user.suspend_reason)
|
||||
}
|
||||
else
|
||||
result = {
|
||||
authenticated: !!authenticated,
|
||||
awaiting_activation: !!awaiting_activation,
|
||||
awaiting_approval: !!awaiting_approval,
|
||||
not_allowed_from_ip_address: !!not_allowed_from_ip_address,
|
||||
admin_not_allowed_from_ip_address: !!admin_not_allowed_from_ip_address
|
||||
}
|
||||
result =
|
||||
if omniauth_disallow_totp
|
||||
{
|
||||
omniauth_disallow_totp: !!omniauth_disallow_totp,
|
||||
email: email
|
||||
}
|
||||
else
|
||||
{
|
||||
authenticated: !!authenticated,
|
||||
awaiting_activation: !!awaiting_activation,
|
||||
awaiting_approval: !!awaiting_approval,
|
||||
not_allowed_from_ip_address: !!not_allowed_from_ip_address,
|
||||
admin_not_allowed_from_ip_address: !!admin_not_allowed_from_ip_address
|
||||
}
|
||||
end
|
||||
|
||||
result[:destination_url] = destination_url if authenticated && destination_url.present?
|
||||
result
|
||||
end
|
||||
|
Reference in New Issue
Block a user