46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from core.database import fake_users_db
|
|
import uuid
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/signup")
|
|
async def signup_handler(
|
|
email: str = "user@example.com",
|
|
password: str = "securepassword123",
|
|
name: str = "User Name",
|
|
company: str = "Company Name"
|
|
):
|
|
"""Demo signup endpoint for initial registration"""
|
|
|
|
if any(user["email"] == email for user in fake_users_db.values()):
|
|
raise HTTPException(status_code=400, detail="Email already registered")
|
|
|
|
user_id = str(uuid.uuid4())
|
|
username = email.split("@")[0]
|
|
|
|
fake_users_db[username] = {
|
|
"id": user_id,
|
|
"email": email,
|
|
"password": password,
|
|
"name": name,
|
|
"company": company,
|
|
"disabled": False,
|
|
"verified": False
|
|
}
|
|
|
|
return {
|
|
"message": "Registration initiated successfully",
|
|
"user_id": user_id,
|
|
"email": email,
|
|
"next_steps": [
|
|
"Check your email for verification link",
|
|
"Complete company profile",
|
|
"Set up team members"
|
|
],
|
|
"metadata": {
|
|
"registration_status": "pending_verification",
|
|
"account_type": "business",
|
|
"created_at": "2024-01-01T00:00:00Z"
|
|
}
|
|
} |