Qualitätsanpassungen
This commit is contained in:
@@ -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