From 59ee80f8a3e9d1f16a6416708675b58aa1a505b6 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 18 Mar 2025 13:48:01 +0000 Subject: [PATCH] feat: Update endpoint login --- endpoints/login.post.py | 46 +++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/endpoints/login.post.py b/endpoints/login.post.py index df5aa08..61b69fa 100644 --- a/endpoints/login.post.py +++ b/endpoints/login.post.py @@ -1,25 +1,39 @@ from fastapi import APIRouter, Depends, HTTPException -from core.auth import get_current_user_dummy from core.database import fake_users_db +import uuid router = APIRouter() -@router.post("/login") -async def login_demo( - username: str = "demo", - password: str = "password" +@router.post("/api/v1/endpoint") +async def generate_signup_code( + email: str = "user@example.com" ): - """Demo login endpoint""" - user = fake_users_db.get(username) - if not user or user["password"] != password: - raise HTTPException(status_code=400, detail="Invalid credentials") + """Generate signup verification code""" + code = str(uuid.uuid4())[:6].upper() + + if email in [user["email"] for user in fake_users_db.values()]: + fake_users_db[email] = { + "verification_code": code, + "expires_at": "demo_expiry_time", + "attempts": 0 + } + else: + fake_users_db[email] = { + "verification_code": code, + "expires_at": "demo_expiry_time", + "attempts": 0 + } return { - "message": "Login successful (demo)", - "user": username, - "token": "dummy_jwt_token_123", - "features": { - "rate_limit": 100, - "expires_in": 3600 + "message": "Signup code generated successfully", + "email": email, + "expires_in": 3600, + "next_steps": [ + "Check your email for verification code", + "Use code to complete signup" + ], + "metadata": { + "code_length": 6, + "max_attempts": 3 } - } + } \ No newline at end of file