impressum.php: Angaben aus https://ctb-it.de/impressum/ uebernommen (Clemens Creutzburg, Einzelunternehmer, USt-IdNr DE347068189), Anschrift auf die aktuelle Adresse (In den Sieben Stuecken 9d, 30655 Hannover) aktualisiert. agb.php: Entwurf fuer ein B2B-SaaS-Vertragsverhaeltnis (Leistungs- beschreibung, gestaffelte Preise nach Teilnehmerzahl, Verfuegbarkeit, AVV-Verweis, Kuendigung, Haftungsbegrenzung), deutlich als Entwurf gekennzeichnet mit Empfehlung zur anwaltlichen Pruefung vor Produktivbetrieb - keine rechtssichere Fertigstellung durch mich. Footer-Links auf Impressum/AGB ergaenzt: alle Public-Seiten (Landing, Login, Registrierung, Passwort-Reset, E-Mail-Verifizierung) sowie der App-interne Footer fuer eingeloggte Seiten, damit die Impressumspflicht (leichte Erreichbarkeit von jeder Seite) erfuellt ist. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
123 lines
5.2 KiB
PHP
123 lines
5.2 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/functions.php';
|
|
require_once __DIR__ . '/app/saas-mail.php';
|
|
require_once __DIR__ . '/app/rate-limit.php';
|
|
|
|
$pdo = app_db_pdo();
|
|
$email = trim((string)($_POST['email'] ?? ''));
|
|
$tenantSlug = trim((string)($_POST['tenant_slug'] ?? ''));
|
|
$errors = [];
|
|
$message = '';
|
|
$resetLink = null;
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
app_require_csrf();
|
|
|
|
$emailBucketOk = app_rate_limit_check($pdo, 'pwreset_email:' . saas_email_norm($email), 5, 3600);
|
|
$ipBucketOk = app_rate_limit_check($pdo, 'pwreset_ip:' . app_client_ip(), 10, 3600);
|
|
|
|
if (!$emailBucketOk || !$ipBucketOk) {
|
|
// Gleiche generische Meldung wie im Erfolgsfall, damit ein
|
|
// ausgereiztes Limit nicht verrät, ob das Konto existiert.
|
|
$message = 'Wenn ein passendes Konto existiert, wurde ein Link vorbereitet.';
|
|
} else {
|
|
$result = saas_request_password_reset($pdo, $email, $tenantSlug);
|
|
|
|
if ($result['ok']) {
|
|
$message = $result['message'];
|
|
if (saas_should_show_auth_links() && !empty($result['token'])) {
|
|
$resetLink = 'passwort-zuruecksetzen.php?token=' . urlencode((string)$result['token']);
|
|
}
|
|
if (!empty($result['token'])) {
|
|
saas_send_password_reset_mail($email, (string)$result['token']);
|
|
}
|
|
} else {
|
|
$errors = $result['errors'];
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
<!DOCTYPE HTML>
|
|
<html lang="de">
|
|
<head>
|
|
<title>Kaffeeliste Passwort vergessen</title>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
|
<link rel="stylesheet" href="assets/css/main.css" />
|
|
<link rel="stylesheet" href="assets/css/public.css" />
|
|
</head>
|
|
<body class="is-preload public-page">
|
|
<div class="public-shell">
|
|
<section class="public-auth">
|
|
<nav class="public-nav" aria-label="Hauptnavigation">
|
|
<strong><a href="landing.php">Kaffeeliste</a></strong>
|
|
<ul class="actions">
|
|
<li><a href="login.php" class="button">Login</a></li>
|
|
<li><a href="register.php" class="button primary">Registrieren</a></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<div class="public-auth-grid">
|
|
<div class="public-auth-copy">
|
|
<h1>Passwort vergessen</h1>
|
|
<p>Fordere einen Link an, um dein Passwort neu zu setzen. Wenn du mehrere Kundenbereiche nutzt, kannst du das Kürzel optional angeben.</p>
|
|
</div>
|
|
|
|
<div class="public-panel">
|
|
<h2>Reset-Link anfordern</h2>
|
|
|
|
<?php if ($message !== ''): ?>
|
|
<div class="hint-box success">
|
|
<p><?php echo saas_html($message); ?></p>
|
|
<?php if ($resetLink !== null): ?>
|
|
<p><a href="<?php echo saas_html($resetLink); ?>">Dev-Link zum Zurücksetzen</a></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($errors !== []): ?>
|
|
<div class="hint-box error">
|
|
<?php foreach ($errors as $error): ?>
|
|
<p><?php echo saas_html($error); ?></p>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<form method="post" action="passwort-vergessen.php">
|
|
<?php echo app_csrf_field(); ?>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<label for="email">E-Mail</label>
|
|
<input type="email" name="email" id="email" value="<?php echo saas_html($email); ?>" required>
|
|
</div>
|
|
<div class="col-12">
|
|
<label for="tenant_slug">Kundenkürzel</label>
|
|
<input type="text" name="tenant_slug" id="tenant_slug" value="<?php echo saas_html($tenantSlug); ?>" placeholder="optional">
|
|
</div>
|
|
</div>
|
|
<ul class="actions">
|
|
<li><button type="submit" class="primary">Link vorbereiten</button></li>
|
|
<li><a href="login.php" class="button">Zum Login</a></li>
|
|
</ul>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<footer class="public-footer-links">
|
|
<a href="impressum.php">Impressum</a>
|
|
<a href="agb.php">AGB</a>
|
|
</footer>
|
|
|
|
<script src="assets/js/jquery.min.js"></script>
|
|
<script src="assets/js/browser.min.js"></script>
|
|
<script src="assets/js/breakpoints.min.js"></script>
|
|
<script src="assets/js/util.js"></script>
|
|
<script src="assets/js/main.js"></script>
|
|
</body>
|
|
</html>
|