From 917395570cb83c87c97c5cd15b3354357cebab34 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 19 Mar 2025 23:31:12 +0000 Subject: [PATCH] Update code in endpoints/login.post.py --- endpoints/login.post.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/endpoints/login.post.py b/endpoints/login.post.py index df5aa08..504aa59 100644 --- a/endpoints/login.post.py +++ b/endpoints/login.post.py @@ -1,25 +1,25 @@ from fastapi import APIRouter, Depends, HTTPException -from core.auth import get_current_user_dummy from core.database import fake_users_db router = APIRouter() @router.post("/login") -async def login_demo( - username: str = "demo", - password: str = "password" +async def login_handler( + username: str, + password: str ): - """Demo login endpoint""" + """Authenticate user and return login token""" user = fake_users_db.get(username) if not user or user["password"] != password: - raise HTTPException(status_code=400, detail="Invalid credentials") + raise HTTPException(status_code=400, detail="Invalid username or password") return { - "message": "Login successful (demo)", + "message": "Login successful", "user": username, - "token": "dummy_jwt_token_123", + "token": "demo_jwt_token_" + username, "features": { "rate_limit": 100, - "expires_in": 3600 + "expires_in": 3600, + "permissions": ["read", "write"] } - } + } \ No newline at end of file