From ebe298113c7ed047eb5334b37e7d7f512f7f3aaa Mon Sep 17 00:00:00 2001 From: RJPvT <48353029+RJPvT@users.noreply.github.com> Date: Tue, 28 Apr 2020 21:21:17 +0200 Subject: [PATCH] fix: case where background task had no IP (cherry picked from commit 67374fdb94937231a7b3f2d4b9fcf5e6323e4e56) --- frappe/twofactor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/twofactor.py b/frappe/twofactor.py index b44092d6a1..253636764f 100644 --- a/frappe/twofactor.py +++ b/frappe/twofactor.py @@ -30,7 +30,7 @@ def two_factor_is_enabled(user=None): if bypass_two_factor_auth and user: user_doc = frappe.get_doc("User", user) restrict_ip_list = user_doc.get_restricted_ip_list() #can be None or one or more than one ip address - if restrict_ip_list: + if restrict_ip_list and frappe.local.request_ip: for ip in restrict_ip_list: if frappe.local.request_ip.startswith(ip): enabled = False