Update code in endpoints/api/v1/endpoint.post.py
This commit is contained in:
parent
3e67da5f48
commit
507de34702
39
endpoints/api/v1/endpoint.post.py
Normal file
39
endpoints/api/v1/endpoint.post.py
Normal file
@ -0,0 +1,39 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from core.database import fake_users_db
|
||||
import uuid
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/api/v1/endpoint")
|
||||
async def generate_signup_code(
|
||||
email: str = "user@example.com"
|
||||
):
|
||||
"""Generate signup verification code"""
|
||||
code = str(uuid.uuid4())[:6].upper()
|
||||
|
||||
if email in [user["email"] for user in fake_users_db.values()]:
|
||||
fake_users_db[email] = {
|
||||
"verification_code": code,
|
||||
"expires_at": "demo_expiry_time",
|
||||
"attempts": 0
|
||||
}
|
||||
else:
|
||||
fake_users_db[email] = {
|
||||
"verification_code": code,
|
||||
"expires_at": "demo_expiry_time",
|
||||
"attempts": 0
|
||||
}
|
||||
|
||||
return {
|
||||
"message": "Signup code generated successfully",
|
||||
"email": email,
|
||||
"expires_in": 3600,
|
||||
"next_steps": [
|
||||
"Check your email for verification code",
|
||||
"Use code to complete signup"
|
||||
],
|
||||
"metadata": {
|
||||
"code_length": 6,
|
||||
"max_attempts": 3
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user