v1.6.0: Admin-Passwort-Reset, Login per Nachname, Default-PW-Sperre
This commit is contained in:
+15
-3
@@ -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 };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user