Initial implementation: Logbuch Sternwarte Welzheim

Vollständige Next.js 16 Webanwendung als Logbuch für die Sternwarte Welzheim.
4 Kuppeln (West/Ost/Süd/Pluto), BEO-basierte Authentifizierung mit erzwungenem
Passwort-Wechsel beim Erstlogin, MySQL-Backend, Docker-Deployment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-27 17:11:27 +02:00
parent f0a86627e5
commit 4e53a7a5cd
29 changed files with 1827 additions and 97 deletions

37
app/login/actions.ts Normal file
View File

@@ -0,0 +1,37 @@
'use server';
import { redirect } from 'next/navigation';
import { verifyCredentials } from '@/lib/auth';
import { createSession } from '@/lib/session';
export async function login(
_prevState: { error: string } | undefined,
formData: FormData
): Promise<{ error: string }> {
const kuerzel = (formData.get('username') as string)?.trim();
const password = formData.get('password') as string;
if (!kuerzel || !password) {
return { error: 'Bitte Kürzel und Passwort eingeben.' };
}
const result = await verifyCredentials(kuerzel, password);
if (!result || !result.valid) {
return { error: 'Ungültiges Kürzel oder Passwort.' };
}
await createSession({
kuerzel: result.beo.Kuerzel,
beoId: result.beo.ID,
beoName: result.beo.Name,
mustChangePassword: result.beo.MustChangePassword === 1,
isAuthenticated: true,
});
if (result.beo.MustChangePassword === 1) {
redirect('/change-password');
}
redirect('/');
}