feat: Update endpoint login
This commit is contained in:
parent
77830aef40
commit
ae616505bd
@ -1,25 +1,19 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from core.auth import get_current_user_dummy
|
||||
from core.database import fake_users_db
|
||||
|
||||
#router instantiation
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/login")
|
||||
async def login_demo(
|
||||
username: str = "demo",
|
||||
password: str = "password"
|
||||
):
|
||||
"""Demo login endpoint"""
|
||||
user = fake_users_db.get(username)
|
||||
if not user or user["password"] != password:
|
||||
raise HTTPException(status_code=400, detail="Invalid credentials")
|
||||
|
||||
@router.post("/endpoint")
|
||||
async def update_credentials_error():
|
||||
"""Update invalid credentials error to no credentials"""
|
||||
return {
|
||||
"message": "Login successful (demo)",
|
||||
"user": username,
|
||||
"token": "dummy_jwt_token_123",
|
||||
"features": {
|
||||
"rate_limit": 100,
|
||||
"expires_in": 3600
|
||||
"message": "Error message updated successfully",
|
||||
"old_message": "Invalid credentials",
|
||||
"new_message": "No credentials",
|
||||
"metadata": {
|
||||
"status": "success",
|
||||
"affected_endpoints": ["login", "auth"],
|
||||
"timestamp": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user