From cb6a49cc8ba89af7182b53cc22c3d8307e9c16e1 Mon Sep 17 00:00:00 2001 From: rizwanisready Date: Thu, 23 May 2024 12:49:56 +0530 Subject: [PATCH] otp bug solved --- accounts/api/utils.py | 2 +- goodtimes/services.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/accounts/api/utils.py b/accounts/api/utils.py index d18dd71..0c860ca 100644 --- a/accounts/api/utils.py +++ b/accounts/api/utils.py @@ -68,7 +68,7 @@ def authticate_with_otp_and_passsword(principal: IAmPrincipal, otp=None, passwor if otp: otp_instance = IAmPrincipalOtp.objects.filter( - principal=principal, otp_code=otp + principal=principal, otp_code=otp, is_used=False ).last() if not otp_instance: diff --git a/goodtimes/services.py b/goodtimes/services.py index 263cb21..0468a27 100644 --- a/goodtimes/services.py +++ b/goodtimes/services.py @@ -148,6 +148,7 @@ class SMSService: def create_otp(self, principal: IAmPrincipal, opt_purpose: str): old_otp_change = IAmPrincipalOtp.objects.filter(principal=principal).update(is_used=True) + print("Everything Is Used..!!") otp = IAmPrincipalOtp.objects.create( principal=principal, otp_purpose=opt_purpose )