Update code in endpoints/signup.post.py
This commit is contained in:
parent
0ac86f536b
commit
a4039b75da
@ -1,33 +1,46 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from core.database import fake_users_db
|
||||
import uuid
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/signup")
|
||||
async def signup_demo(
|
||||
username: str = "new_user",
|
||||
async def signup_handler(
|
||||
email: str = "user@example.com",
|
||||
password: str = "securepassword123"
|
||||
password: str = "securepassword123",
|
||||
name: str = "User Name",
|
||||
company: str = "Company Name"
|
||||
):
|
||||
"""Demo signup endpoint"""
|
||||
if username in fake_users_db:
|
||||
raise HTTPException(status_code=400, detail="Username already exists")
|
||||
"""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,
|
||||
"disabled": False
|
||||
"name": name,
|
||||
"company": company,
|
||||
"disabled": False,
|
||||
"verified": False
|
||||
}
|
||||
|
||||
return {
|
||||
"message": "User created successfully",
|
||||
"message": "Registration initiated successfully",
|
||||
"user_id": user_id,
|
||||
"username": username,
|
||||
"email": email,
|
||||
"next_steps": [
|
||||
"Verify your email (demo)",
|
||||
"Complete profile setup"
|
||||
]
|
||||
}
|
||||
"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"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user