From 8a57fdad7a08e87fd0e0f8c208dbec725d42ed2c Mon Sep 17 00:00:00 2001 From: DIKER0K Date: Mon, 21 Jul 2025 09:03:46 +0500 Subject: [PATCH] add: route get verification status --- app/api/users.py | 4 ++++ app/services/auth.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/app/api/users.py b/app/api/users.py index f7ab0e6..8f58a48 100644 --- a/app/api/users.py +++ b/app/api/users.py @@ -125,3 +125,7 @@ async def verify_code(verify_code: VerifyCode): @router.post("/auth/generate_code") async def generate_code(username: str): return await AuthService().generate_code(username) + +@router.get("/auth/verification_status/{username}") +async def get_verification_status(username: str): + return await AuthService().get_verification_status(username) diff --git a/app/services/auth.py b/app/services/auth.py index aa2e24b..11f22c3 100644 --- a/app/services/auth.py +++ b/app/services/auth.py @@ -82,6 +82,12 @@ class AuthService: }} ) return {"status": "success"} + + async def get_verification_status(self, username: str): + user = await users_collection.find_one({"username": username}) + if not user: + raise HTTPException(404, "User not found") + return {"is_verified": user["is_verified"]} async def login(self, credentials: UserLogin): # Ищем пользователя