v1.6.0: Admin-Passwort-Reset, Login per Nachname, Default-PW-Sperre

This commit is contained in:
2026-05-11 12:20:44 +02:00
parent 4d84b8f718
commit 0ea960259c
12 changed files with 195 additions and 15 deletions
+15 -3
View File
@@ -19,15 +19,27 @@ export async function getBeoByKuerzel(kuerzel: string): Promise<Beo | null> {
return rows[0] ?? null;
}
export async function getBeoByLogin(login: string): Promise<Beo | null> {
// First try exact Kürzel match, then case-insensitive Nachname match
const byKuerzel = await getBeoByKuerzel(login);
if (byKuerzel) return byKuerzel;
const rows = await query(
'SELECT id, name, vorname, `kürzel`, pw, MustChangePassword, role FROM beos WHERE LOWER(name) = LOWER(?)',
[login]
) as Beo[];
return rows[0] ?? null;
}
export async function verifyCredentials(
kuerzel: string,
login: string,
password: string
): Promise<{ beo: Beo; valid: boolean } | null> {
const beo = await getBeoByKuerzel(kuerzel);
const beo = await getBeoByLogin(login);
if (!beo) return null;
if (!beo.pw) {
const valid = password === 'logbuch123';
const valid = password === 'welzheim';
return { beo, valid };
}