From 123345fac508b58ea38087c69cc75e320a7d33b0 Mon Sep 17 00:00:00 2001 From: Gagan Trivedi Date: Tue, 21 May 2024 13:15:39 +0530 Subject: [PATCH] implement validate code to support 5mins --- api/custom_auth/mfa/backends/application.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/custom_auth/mfa/backends/application.py b/api/custom_auth/mfa/backends/application.py index 873f6107f33bb..0ee1b87be29a4 100644 --- a/api/custom_auth/mfa/backends/application.py +++ b/api/custom_auth/mfa/backends/application.py @@ -10,3 +10,6 @@ def dispatch_message(self): "secret": self._mfa_method.secret, } return Response(data) + + def validate_code(self, code: str) -> bool: + return self._get_otp().verify(otp=code, valid_window=20)