add: route get verification status
All checks were successful
Build and Deploy / deploy (push) Successful in 21s

This commit is contained in:
2025-07-21 09:03:46 +05:00
parent a404377108
commit 8a57fdad7a
2 changed files with 10 additions and 0 deletions

View File

@ -125,3 +125,7 @@ async def verify_code(verify_code: VerifyCode):
@router.post("/auth/generate_code") @router.post("/auth/generate_code")
async def generate_code(username: str): async def generate_code(username: str):
return await AuthService().generate_code(username) 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)

View File

@ -83,6 +83,12 @@ class AuthService:
) )
return {"status": "success"} 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): async def login(self, credentials: UserLogin):
# Ищем пользователя # Ищем пользователя
user = await users_collection.find_one({"username": credentials.username}) user = await users_collection.find_one({"username": credentials.username})