From 8f036af25cd55856d6e5d51906afd602b3db2c80 Mon Sep 17 00:00:00 2001 From: flavien-hugs Date: Fri, 10 Jan 2025 11:01:36 +0000 Subject: [PATCH] feat: check if user account with phonenumber is desabled --- src/services/auth/phonenumber.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/services/auth/phonenumber.py b/src/services/auth/phonenumber.py index 081968a..a224b7c 100644 --- a/src/services/auth/phonenumber.py +++ b/src/services/auth/phonenumber.py @@ -30,6 +30,14 @@ async def find_user_by_phonenumber(phonenumber: str): status_code=status.HTTP_404_NOT_FOUND, ) + if not user.is_active: + raise CustomHTTPException( + code_error=UserErrorCode.USER_ACCOUND_DESABLE, + message_error=f"User account with phone number {phone!r} is disabled." + f" Please request to activate the account.", + status_code=status.HTTP_400_BAD_REQUEST, + ) + user_dict = jsonable_encoder( { "fullname": user.fullname,