Update code in endpoints/login.post.py
This commit is contained in:
parent
e5a19384f3
commit
9ee36c18f4
@ -1,21 +1,21 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
|
||||
users = [] # In-memory storage
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/login")
|
||||
async def login_simple(
|
||||
async def login_demo(
|
||||
username: str = "demo",
|
||||
password: str = "password"
|
||||
):
|
||||
"""Simple login endpoint"""
|
||||
"""Demo 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")
|
||||
|
||||
return {
|
||||
"message": "Login successful",
|
||||
"message": "Login successful (demo)",
|
||||
"user": username,
|
||||
"token": "dummy_jwt_token_123",
|
||||
"features": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user