From 3528ca34df08a2aa263890de6a0350d247e548de Mon Sep 17 00:00:00 2001 From: divyesh000 Date: Tue, 21 May 2024 20:45:25 +0400 Subject: [PATCH 1/3] add registration success flag and dialog to Register controller and view --- src/controllers/Register.php | 10 ++++++---- src/views/Register.php | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/controllers/Register.php b/src/controllers/Register.php index 95d86fd..99d2436 100644 --- a/src/controllers/Register.php +++ b/src/controllers/Register.php @@ -34,6 +34,7 @@ public function __construct() $this->view_data['errors'] = []; $this->view_data['editMode'] = false; $this->view_data['form_submitted'] = false; + $this->view_data['$registration_is_successful'] = false; // get list of districts to be displayed on form $this->view_data['districts'] = District::getAll(); @@ -114,11 +115,12 @@ private function handleFormSubmission(): void $success = $client->save(); if ($success) { - Utility::redirect('login'); + $this->view_data['registration_is_successful'] = true; + } else { + (new Error())->handleUnknownError(); + die(); } - - (new Error())->handleUnknownError(); - die(); + } else { $this->loadDataToForm($form_data); } diff --git a/src/views/Register.php b/src/views/Register.php index e26a637..5f6b310 100644 --- a/src/views/Register.php +++ b/src/views/Register.php @@ -19,6 +19,7 @@ * @var string $defaultConfirmPassword * @var array $errors list of errors in form after submission * @var District[] $districts list of all district objects + * @var bool $registration_is_successful */ @@ -220,3 +221,18 @@ function togglePasswordVisibility() { } } + +> +
+

Successfully registered! 🎉

+

Thank you for joining Steamy Sips. Your account has been successfully created.

+ +
+
\ No newline at end of file From 74a0af5a68f3e8113e4dfe0bb8c7254f0c183b8a Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Fri, 24 May 2024 21:42:09 +0400 Subject: [PATCH 2/3] remove data-target from dialog --- src/views/Register.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/Register.php b/src/views/Register.php index 5f6b310..c0cef26 100644 --- a/src/views/Register.php +++ b/src/views/Register.php @@ -229,7 +229,6 @@ function togglePasswordVisibility() {