LuminaWebsite/change_password.php
Maaxxs 77bb1b3ff5 Use real German umlauts instead of ASCII transliterations
Every "oe/ae/ue" spelling throughout the UI text and comments (fuer,
loeschen, koennen, ...) was my own typo, not an encoding bug - the
charset fix in the last commit was unrelated. Replaced all of them
with proper ö/ä/ü across every PHP file and the README.

Also fix table rows rendering inconsistently: `.actions` and the
status badges were applying `display:flex` directly to a <td>, which
fights the table layout model and renders unreliably across browsers.
Moved the flex layout into a wrapper <div> inside each cell instead,
and restyled row-level delete buttons as plain text links so they
match the height of the "Bearbeiten" link exactly. Tables also get a
horizontal-scroll wrapper so narrow viewports scroll instead of
squeezing cell content.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 07:16:15 +02:00

51 lines
1.9 KiB
PHP

<?php
require_once __DIR__ . '/includes/bootstrap.php';
require_login();
$user = current_user();
$error = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
verify_csrf();
$newPassword = (string) ($_POST['new_password'] ?? '');
$newPasswordConfirm = (string) ($_POST['new_password_confirm'] ?? '');
if (strlen($newPassword) < 8) {
$error = 'Das neue Passwort muss mindestens 8 Zeichen lang sein.';
} elseif ($newPassword !== $newPasswordConfirm) {
$error = 'Die Passwörter stimmen nicht überein.';
} else {
$stmt = db()->prepare('UPDATE users SET password_hash = ?, must_change_password = 0 WHERE id = ?');
$stmt->execute([password_hash($newPassword, PASSWORD_DEFAULT), $user['id']]);
set_flash('success', 'Passwort wurde geändert.');
redirect('/dashboard.php');
}
}
$pageTitle = 'Passwort ändern';
include __DIR__ . '/includes/header.php';
?>
<div class="panel panel-narrow">
<h1>Passwort ändern</h1>
<p class="text-muted">
<?= $user['must_change_password'] ? 'Du musst dein Passwort ändern, bevor du fortfahren kannst.' : 'Passwort ändern' ?>
</p>
<?php if ($error): ?>
<div class="flash flash-error"><?= e($error) ?></div>
<?php endif; ?>
<form method="post" action="/change_password.php">
<?= csrf_field() ?>
<div>
<label for="new_password">Neues Passwort</label>
<input type="password" id="new_password" name="new_password" required autofocus>
<div class="field-hint">Mindestens 8 Zeichen.</div>
</div>
<div>
<label for="new_password_confirm">Neues Passwort wiederholen</label>
<input type="password" id="new_password_confirm" name="new_password_confirm" required>
</div>
<button type="submit">Passwort speichern</button>
</form>
</div>
<?php include __DIR__ . '/includes/footer.php'; ?>