V 1.2.2 Login-Seite: bcrypt-Passwörter, Passwort-Toggle, Footer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 09:21:38 +02:00
parent 8bfc2b685b
commit 325c07b469
6 changed files with 107 additions and 24 deletions
+6 -8
View File
@@ -1,8 +1,4 @@
/**
* Authentifizierungsbibliothek
* Benutzer via Umgebungsvariable konfigurieren:
* AUTH_USERS=user1:passwort1,user2:passwort2
*/
import bcrypt from 'bcryptjs';
export interface User {
username: string;
@@ -24,11 +20,13 @@ export function getUsers(): User[] {
.filter((user) => user.username && user.password);
}
export function verifyCredentials(username: string, password: string): boolean {
export async function verifyCredentials(username: string, password: string): Promise<boolean> {
const users = getUsers();
const user = users.find(u => u.username === username);
if (!user) return false;
return user.password === password;
if (!user) {
return false;
}
return bcrypt.compare(password, user.password);
}
export function isAuthEnabled(): boolean {