Refactor: Name-Feld entfernen, Email als einziger Identifier
- Name-Spalte aus Nutzertabelle entfernt - Anzeigename-Feld aus Nutzer-Anlegen-Dialog entfernt - Username wird automatisch aus Email-Prefix generiert - UserCreate Model: username jetzt optional Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -66,11 +66,12 @@ async def create_user(
|
||||
if await cursor.fetchone():
|
||||
raise HTTPException(status_code=400, detail="E-Mail bereits vergeben")
|
||||
|
||||
username = data.username if data.username else email.split("@")[0]
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
cursor = await db.execute(
|
||||
"""INSERT INTO users (email, username, password_hash, organization_id, role, is_active, created_at)
|
||||
VALUES (?, ?, '', ?, ?, 1, ?)""",
|
||||
(email, data.username, org_id, data.role, now),
|
||||
(email, username, org_id, data.role, now),
|
||||
)
|
||||
user_id = cursor.lastrowid
|
||||
|
||||
@@ -91,7 +92,7 @@ async def create_user(
|
||||
from email_utils.sender import send_email
|
||||
from email_utils.templates import invite_email
|
||||
link = f"{MAGIC_LINK_BASE_URL}/auth/verify?token={token}"
|
||||
subject, html = invite_email(data.username, org["name"], code, link)
|
||||
subject, html = invite_email(username, org["name"], code, link)
|
||||
await send_email(email, subject, html)
|
||||
except Exception:
|
||||
pass # E-Mail-Fehler nicht fatal
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren