diff --git a/php/controller/register-controller.php b/php/controller/register-controller.php index 4835290..28f1e19 100644 --- a/php/controller/register-controller.php +++ b/php/controller/register-controller.php @@ -38,6 +38,22 @@ 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) @@ -71,7 +87,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { xy.'; } catch (Exception $e) { - $error = "Die Registrierung konnte nicht verarbeitet werden."; + $error = $e->getMessage(); } } } \ No newline at end of file