Implementierung

This commit is contained in:
2026-06-25 22:46:14 +02:00
parent d5a3f4298f
commit 4f524db221
5 changed files with 109 additions and 10 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
require_once "php/model/UserManager.php";
$token = basename($_GET["token"] ?? "");
$file = "data/pending/" . $token . ".json";
if (!file_exists($file)) {
echo "<p>Registrierungslink ungültig oder abgelaufen.</p>";
exit();
}
$data = json_decode(file_get_contents($file), true);
if ($data === null) {
echo "<p>Registrierungsdaten konnten nicht gelesen werden.</p>";
exit();
}
try {
$dao = UserManager::getInstance();
if ($dao->findUser($data["email"]) === null) {
$dao->addUser(
$data["email"],
$data["vorname"],
$data["nachname"],
$data["password"]
);
}
unlink($file);
echo "<p>Registrierung erfolgreich abgeschlossen.</p>";
echo '<p><a href="index.php?pfad=login">Jetzt einloggen</a></p>';
} catch (Exception $e) {
echo "<p>Registrierung konnte nicht abgeschlossen werden.</p>";
}
+7
View File
@@ -1,5 +1,6 @@
<?php
$error = $error ?? null;
$success = $success ?? null;
?>
<!--
@@ -17,6 +18,12 @@ $error = $error ?? null;
</p>
<?php endif; ?>
<?php if (!empty($success)): ?>
<p class="alert-message is-success" style="color:green;">
<?php echo $success; ?>
</p>
<?php endif; ?>
<form method="post" action="index.php?pfad=register">
<p class="input-label">Email:</p>
+19
View File
@@ -0,0 +1,19 @@
<?php
$token = basename($_GET["token"] ?? "");
$file = "data/mails/" . $token . ".html";
if (!file_exists($file)) {
echo "<p>Datei nicht gefunden.</p>";
exit();
}
?>
<main class="login-page">
<div class="login-container">
<h1>Simulierte E-Mail</h1>
<?php include $file; ?>
</div>
</main>