From d66478233b4f5201f954c411a60352d182f6a87a Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Mon, 24 Mar 2025 12:44:13 +0000 Subject: [PATCH] Update code in endpoints/login.post.py --- endpoints/login.post.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/endpoints/login.post.py b/endpoints/login.post.py index 63c093e..a30289a 100644 --- a/endpoints/login.post.py +++ b/endpoints/login.post.py @@ -4,18 +4,20 @@ users = [] # In-memory storage router = APIRouter() -@router.post("/login") -async def get_username( - username: str = "demo" +@router.post("/login") +async def login_phone( + phone: str = "+1234567890", + code: str = "123456" ): - """Get username endpoint""" - user = next((u for u in users if u["username"] == username), None) - if not user: - raise HTTPException(status_code=400, detail="Username not found") + """Phone login endpoint""" + user = next((u for u in users if u["phone"] == phone), None) + if not user or user["code"] != code: + raise HTTPException(status_code=400, detail="Invalid credentials") return { - "message": "Username retrieved", - "user": username, + "message": "Login successful", + "user": phone, + "token": "dummy_jwt_token_123", "features": { "rate_limit": 100, "expires_in": 3600