25 lines
635 B
Python
25 lines
635 B
Python
from fastapi import APIRouter, HTTPException
|
|
|
|
users = [] # In-memory storage
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/login")
|
|
async def login_phone(
|
|
phone: str = "+1234567890",
|
|
code: str = "123456"
|
|
):
|
|
"""Phone login endpoint"""
|
|
user = next((u for u in users if u["phone"] == phone), None)
|
|
if not user or user["code"] != code:
|
|
raise HTTPException(status_code=400, detail="Invalid credentials")
|
|
|
|
return {
|
|
"message": "Login successful",
|
|
"user": phone,
|
|
"token": "dummy_jwt_token_123",
|
|
"features": {
|
|
"rate_limit": 100,
|
|
"expires_in": 3600
|
|
}
|
|
} |