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