From 00cd0f8c949008cca29f3c960cf1280d7a03b3d1 Mon Sep 17 00:00:00 2001 From: George J Padayatti Date: Thu, 30 Nov 2023 14:27:23 +0530 Subject: [PATCH] Upd: Query user by mobile number Signed-off-by: George J Padayatti --- otp_auth/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otp_auth/user.py b/otp_auth/user.py index fd3768f..e117dc5 100644 --- a/otp_auth/user.py +++ b/otp_auth/user.py @@ -24,7 +24,7 @@ def get_user_by_mobile_number(mobile_number: str) -> typing.Tuple[AbstractBaseUs """Query `User` instance by mobile number and return the `User` instance, existence boolean""" User = get_user_model() try: - user = User.objects.get(username=mobile_number) + user = User.objects.get(mobile_number=mobile_number) return user, True except User.DoesNotExist: return None, False