From 6873919adc40f89e53bf1d5c0015297f028da0e9 Mon Sep 17 00:00:00 2001 From: sandeepsajan0 <sandeepsajan0@gmail.com> Date: Wed, 13 Apr 2022 18:14:33 +0530 Subject: [PATCH] Skip the 2fa for users with social auth --- hypha/apply/users/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypha/apply/users/middleware.py b/hypha/apply/users/middleware.py index b466c1d49..53ae4fc4f 100644 --- a/hypha/apply/users/middleware.py +++ b/hypha/apply/users/middleware.py @@ -46,7 +46,7 @@ class TwoFactorAuthenticationMiddleware: # code to execute before the view user = request.user if settings.ENFORCE_TWO_FACTOR: - if user.is_authenticated and not user.is_verified(): + if user.is_authenticated and not user.is_verified() and not user.social_auth.exists(): if not self.is_path_allowed(request.path): return redirect('/account/two_factor/required/') -- GitLab