asdasd
This commit is contained in:
66
public/auth/forgot-password/index.php
Normal file
66
public/auth/forgot-password/index.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__, 3) . '/src/App/bootstrap.php';
|
||||
|
||||
use App\ConfigLoader;
|
||||
use App\RegistrationService;
|
||||
|
||||
$projectRoot = dirname(__DIR__, 3);
|
||||
$registration = new RegistrationService($projectRoot, ConfigLoader::load($projectRoot, 'registration'));
|
||||
$message = null;
|
||||
$error = null;
|
||||
$username = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$username = trim((string) ($_POST['username'] ?? ''));
|
||||
$origin = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http') . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost');
|
||||
$result = $registration->sendPasswordReset($username, $origin);
|
||||
|
||||
if ($result['success'] ?? false) {
|
||||
$message = (string) ($result['message'] ?? '');
|
||||
} else {
|
||||
$error = (string) ($result['message'] ?? '');
|
||||
}
|
||||
}
|
||||
?><!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Passwort vergessen</title>
|
||||
<link rel="stylesheet" href="/assets/auth/login.css">
|
||||
</head>
|
||||
<body>
|
||||
<main class="login-shell">
|
||||
<section class="login-panel">
|
||||
<div class="login-panel-top">
|
||||
<p class="login-kicker">Kusche.Berlin</p>
|
||||
<h1>Passwort vergessen</h1>
|
||||
<p class="login-copy">Gib deinen Benutzernamen an. Wenn der LDAP-Benutzer eine E-Mail-Adresse hat, senden wir einen 8 Stunden gültigen Reset-Link.</p>
|
||||
</div>
|
||||
|
||||
<?php if ($message !== null): ?>
|
||||
<div class="login-notice login-notice-success"><p><?= htmlspecialchars($message, ENT_QUOTES) ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($error !== null): ?>
|
||||
<div class="login-notice login-notice-error"><p><?= htmlspecialchars($error, ENT_QUOTES) ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form class="login-form" method="post" action="/auth/forgot-password/">
|
||||
<label class="login-field">
|
||||
<span>Benutzername</span>
|
||||
<input type="text" name="username" value="<?= htmlspecialchars($username, ENT_QUOTES) ?>" required>
|
||||
</label>
|
||||
|
||||
<div class="login-actions">
|
||||
<button class="login-button login-button-primary" type="submit">Reset-Link senden</button>
|
||||
<a class="login-button login-button-secondary" href="/auth/login">Zurück zum Login</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user