FEATURE: Disallow login via omniauth when user has 2FA enabled.

This commit is contained in:
Guo Xiang Tan
2018-03-01 15:47:07 +08:00
parent 0fabf80dca
commit fb75f188ba
7 changed files with 77 additions and 25 deletions

View File

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