update emails and verifing

This commit is contained in:
ben
2026-08-18 11:44:09 +02:00
parent 953c371e48
commit 49e0ea5734
3 changed files with 32 additions and 13 deletions
+5 -2
View File
@@ -82,6 +82,7 @@ class Login(BaseModel):
class UserCreate(BaseModel):
username: str
password: str
email: EmailStr
class EventCreate(BaseModel):
@@ -173,24 +174,26 @@ def database_status(
@app.post(
"/create-user",
summary="Create a user",
description="Creates a new user account. The username must be unique.",
description="Creates a new user account and sends an email verification link. Usernames should be unique",
)
def api_create_user(user: UserCreate):
try:
user_id = create_user(
user.username,
user.password,
user.email,
)
except sqlite3.IntegrityError:
raise HTTPException(
status_code=409,
detail="username already exists",
detail="username or email already exists",
)
return {
"status": "created",
"user_id": user_id,
"email_verification": "sent",
}