Update code in endpoints/signup.post.py
This commit is contained in:
parent
9ca62be531
commit
30adb76db0
@ -1,4 +1,4 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from core.database import fake_users_db
|
||||
import uuid
|
||||
|
||||
@ -8,26 +8,49 @@ router = APIRouter()
|
||||
async def signup_demo(
|
||||
username: str = "new_user",
|
||||
email: str = "user@example.com",
|
||||
password: str = "securepassword123"
|
||||
password: str = "securepassword123",
|
||||
first_name: str = "John",
|
||||
last_name: str = "Doe",
|
||||
phone_number: str = "+1234567890"
|
||||
):
|
||||
"""Demo signup endpoint"""
|
||||
"""Demo signup endpoint with extended user details"""
|
||||
if username in fake_users_db:
|
||||
raise HTTPException(status_code=400, detail="Username already exists")
|
||||
|
||||
if not email or '@' not in email:
|
||||
raise HTTPException(status_code=400, detail="Invalid email format")
|
||||
|
||||
user_id = str(uuid.uuid4())
|
||||
fake_users_db[username] = {
|
||||
"id": user_id,
|
||||
"email": email,
|
||||
"password": password,
|
||||
"disabled": False
|
||||
"first_name": first_name,
|
||||
"last_name": last_name,
|
||||
"phone_number": phone_number,
|
||||
"disabled": False,
|
||||
"created_at": str(uuid.uuid1()),
|
||||
"profile_complete": True
|
||||
}
|
||||
|
||||
return {
|
||||
"message": "User created successfully",
|
||||
"user_id": user_id,
|
||||
"username": username,
|
||||
"profile": {
|
||||
"first_name": first_name,
|
||||
"last_name": last_name,
|
||||
"email": email,
|
||||
"phone_number": phone_number
|
||||
},
|
||||
"next_steps": [
|
||||
"Verify your email (demo)",
|
||||
"Complete profile setup"
|
||||
]
|
||||
}
|
||||
"Verify your email address",
|
||||
"Complete additional profile information",
|
||||
"Set up two-factor authentication"
|
||||
],
|
||||
"features": {
|
||||
"rate_limit": 100,
|
||||
"expires_in": 3600,
|
||||
"profile_status": "complete"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user