Qualitätsanpassungen
This commit is contained in:
@@ -18,6 +18,13 @@ if (!file_exists($file)) {
|
||||
|
||||
if ($data === null) {
|
||||
$message = "Die Registrierungsdaten konnten nicht gelesen werden.";
|
||||
} elseif (
|
||||
empty($data["email"]) ||
|
||||
empty($data["vorname"]) ||
|
||||
empty($data["nachname"]) ||
|
||||
empty($data["password"])
|
||||
) {
|
||||
$message = "Die Registrierungsdaten sind unvollständig.";
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
@@ -13,13 +13,13 @@ $success = $success ?? null;
|
||||
<h1>Jetzt Registrieren!</h1>
|
||||
|
||||
<?php if (!empty($error)): ?>
|
||||
<p class="alert-message is-error" style="color:red;">
|
||||
<p class="alert-message is-error">
|
||||
<?php echo htmlspecialchars($error); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($success)): ?>
|
||||
<p class="alert-message is-success" style="color:green;">
|
||||
<p class="alert-message is-success">
|
||||
<?php echo $success; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Zeigt den Inhalt einer simulierten E-Mail an.
|
||||
* Die Datei wird über einen zufällig erzeugten Token geladen.
|
||||
*/
|
||||
|
||||
$token = basename($_GET["token"] ?? "");
|
||||
$file = "data/mails/" . $token . ".html";
|
||||
$file = __DIR__ . "/../data/mails/" . $token . ".html";
|
||||
|
||||
if (!file_exists($file)) {
|
||||
echo "<p>Datei nicht gefunden.</p>";
|
||||
|
||||
@@ -130,13 +130,6 @@ h1 {
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.input-label {
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
width: 100%;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.login-input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
@@ -210,14 +203,6 @@ h1 {
|
||||
.form-container {
|
||||
width: 90%;
|
||||
max-width: 600px;
|
||||
padding: 30px;
|
||||
background-color: white;
|
||||
border: 1px solid #dbe3ec;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.form-container {
|
||||
flex: 1 1 450px;
|
||||
padding: 30px;
|
||||
background-color: white;
|
||||
|
||||
@@ -25,9 +25,26 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
try {
|
||||
$dao = UserManager::getInstance();
|
||||
|
||||
// Token für die simulierte E-Mail und die spätere Bestätigung erzeugen.
|
||||
$token = bin2hex(random_bytes(16));
|
||||
$existingUser = $dao->findUser($email);
|
||||
|
||||
if (!is_dir("data/mails") && !mkdir("data/mails", 0777, true)) {
|
||||
throw new RuntimeException("Ordner data/mails konnte nicht erstellt werden.");
|
||||
}
|
||||
|
||||
if (!is_dir("data/pending") && !mkdir("data/pending", 0777, true)) {
|
||||
throw new RuntimeException("Ordner data/pending konnte nicht erstellt werden.");
|
||||
}
|
||||
|
||||
if (!is_writable("data/mails")) {
|
||||
throw new RuntimeException("Ordner data/mails ist nicht beschreibbar.");
|
||||
}
|
||||
|
||||
if (!is_writable("data/pending")) {
|
||||
throw new RuntimeException("Ordner data/pending ist nicht beschreibbar.");
|
||||
}
|
||||
|
||||
if ($existingUser === null) {
|
||||
$password = password_hash($plainPassword, PASSWORD_DEFAULT);
|
||||
|
||||
@@ -38,22 +55,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
"password" => $password
|
||||
];
|
||||
|
||||
if (!is_dir("data/mails") && !mkdir("data/mails", 0777, true)) {
|
||||
throw new RuntimeException("Ordner data/mails konnte nicht erstellt werden.");
|
||||
}
|
||||
|
||||
if (!is_dir("data/pending") && !mkdir("data/pending", 0777, true)) {
|
||||
throw new RuntimeException("Ordner data/pending konnte nicht erstellt werden.");
|
||||
}
|
||||
|
||||
if (!is_writable("data/mails")) {
|
||||
throw new RuntimeException("Ordner data/mails ist nicht beschreibbar.");
|
||||
}
|
||||
|
||||
if (!is_writable("data/pending")) {
|
||||
throw new RuntimeException("Ordner data/pending ist nicht beschreibbar.");
|
||||
}
|
||||
|
||||
file_put_contents(
|
||||
"data/pending/" . $token . ".json",
|
||||
json_encode($pendingData, JSON_PRETTY_PRINT)
|
||||
@@ -83,6 +84,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
|
||||
file_put_contents("data/mails/" . $token . ".html", $mailContent);
|
||||
|
||||
// Neutrale Meldung, damit nicht sichtbar wird, ob die E-Mail bereits registriert ist.
|
||||
$success = 'Weitere Infos finden Sie in der Datei
|
||||
<a href="index.php?pfad=show-mail&token=' . htmlspecialchars($token) . '" target="_blank">xy</a>.';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user