Skip to content

Commit

Permalink
Merge pull request #201 from Divyesh000/improveuser
Browse files Browse the repository at this point in the history
add registration success flag and dialog to Register controller and view
  • Loading branch information
creme332 authored May 24, 2024
2 parents 254c21a + 02b685c commit 622888a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/controllers/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -114,11 +115,11 @@ 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);
}
Expand Down
15 changes: 15 additions & 0 deletions src/views/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/


Expand Down Expand Up @@ -220,3 +221,17 @@ function togglePasswordVisibility() {
}
}
</script>

<dialog <?= $registration_is_successful ? "open" : "" ?>>
<article>
<h3>Successfully registered! 🎉</h3>
<p>Thank you for joining Steamy Sips. Your account has been successfully created.</p>
<footer>
<a href="/login"
role="button"
>
Return to sign in
</a>
</footer>
</article>
</dialog>

0 comments on commit 622888a

Please sign in to comment.