Update code in endpoints/login.post.py
This commit is contained in:
parent
3248c0ca14
commit
0c260c6250
@ -1,5 +1,4 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
import uuid
|
||||
|
||||
users = [] # In-memory storage
|
||||
|
||||
@ -7,10 +6,10 @@ router = APIRouter()
|
||||
|
||||
@router.post("/login")
|
||||
async def login_user(
|
||||
username: str = "new_user",
|
||||
password: str = "securepassword123"
|
||||
username: str = "user",
|
||||
password: str = "password"
|
||||
):
|
||||
"""User login endpoint"""
|
||||
"""Blog user login endpoint"""
|
||||
user = next((u for u in users if u["username"] == username), None)
|
||||
if not user or user["password"] != password:
|
||||
raise HTTPException(status_code=400, detail="Invalid credentials")
|
||||
@ -18,7 +17,7 @@ async def login_user(
|
||||
return {
|
||||
"message": "Login successful",
|
||||
"user": username,
|
||||
"token": "jwt_token_" + str(uuid.uuid4()),
|
||||
"token": "blog_jwt_token_123",
|
||||
"features": {
|
||||
"rate_limit": 100,
|
||||
"expires_in": 3600
|
||||
|
Loading…
x
Reference in New Issue
Block a user