From 57b07825774a4f2f1155433494bc2f7ba616411d Mon Sep 17 00:00:00 2001 From: Caroline Schulte Date: Thu, 25 Jun 2026 22:53:45 +0200 Subject: [PATCH] test --- php/controller/register-controller.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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