Rebuild OMSORG Connect from scratch: login-only milestone

New omsorgWeb/mitarbeiter-app/ replaces the legacy PHP app for now
with just the login flow, built fresh instead of incrementally
refactored. Reuses the already-working omsorgCore JWT auth pattern
(login, silent refresh, session-stored token pair, /api/auth/me for
role+permissions) but drops everything legacy carried alongside it:
no local MySQL user cache, no admin/user-management endpoints, no
admin UI. Employee/user management stays exclusive to OMSORG Desktop
per architecture decision - Connect only ever acts on the current
user's own session.

logout.php additionally revokes the refresh token server-side via
omsorgcore_logout(), which the legacy version never did.

Verified end-to-end against a running omsorgCore instance: login,
dashboard via /api/auth/me, logout + token revocation, unauth
redirect, and wrong-credential error handling.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Felix Kemmler
2026-08-07 14:32:55 +02:00
co-authored by Claude Sonnet 5
parent b6c1389c55
commit ee74ed65f5
11 changed files with 502 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
<?php
require_once __DIR__ . '/lib/auth.php';
if (is_logged_in()) {
header('Location: pages/dashboard.php');
exit;
}
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
verify_csrf();
$username = trim($_POST['username'] ?? '');
$password = $_POST['password'] ?? '';
if ($username !== '' && $password !== '') {
$result = omsorgcore_login(_omsorgcore_config(), $username, $password);
if ($result['ok']) {
session_regenerate_id(true);
_apply_token_pair($result['data']);
_refresh_profile();
header('Location: pages/dashboard.php');
exit;
}
if ($result['status'] === 429) {
$error = 'Zu viele Fehlversuche. Bitte warte ca. 10 Minuten.';
} elseif ($result['status'] === 0) {
$error = 'Server nicht erreichbar. Bitte später erneut versuchen.';
} else {
$error = 'Benutzername oder Passwort falsch.';
}
} else {
$error = 'Benutzername oder Passwort falsch.';
}
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>OMSORG Mitarbeiter-App Login</title>
<link rel="stylesheet" href="app.css">
</head>
<body>
<div class="login-page">
<div class="login-card glass">
<div class="brand" style="text-align:center">
<img src="assets/omsorg-wordmark-new.png" alt="OMSORG" style="width:210px;margin:0 auto 22px">
</div>
<h2 style="font-family:'KindelSerif',Georgia,serif;font-size:1.7rem;margin:0 0 6px">Mitarbeiter-App</h2>
<p class="hint" style="margin:0 0 22px">Melde dich mit deinem Benutzerkonto an.</p>
<?php if ($error): ?>
<div class="error" style="margin-bottom:16px"><?= e($error) ?></div>
<?php endif; ?>
<form method="post">
<?= csrf_field() ?>
<label>
Benutzername
<input type="text" name="username" autocomplete="username" required autofocus
value="<?= e($_POST['username'] ?? '') ?>">
</label>
<label>
Passwort
<input type="password" name="password" autocomplete="current-password" required>
</label>
<button type="submit" class="btn" style="width:100%;margin-top:6px">Anmelden</button>
</form>
</div>
</div>
</body>
</html>