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:
claude-dev
2026-03-05 18:55:30 +01:00
Ursprung e5a11d3549
Commit af6040cbf6
4 geänderte Dateien mit 5 neuen und 11 gelöschten Zeilen

Datei anzeigen

@@ -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