Skip to content

Commit

Permalink
init form_submitted, call appropriate method from Error controller
Browse files Browse the repository at this point in the history
  • Loading branch information
creme332 committed May 16, 2024
1 parent d120f6b commit 75645d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controllers/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function __construct()
$this->view_data['defaultConfirmPassword'] = "";
$this->view_data['errors'] = [];
$this->view_data['editMode'] = false;
$this->view_data['form_submitted'] = false;

// get list of districts to be displayed on form
$this->view_data['districts'] = District::getAll();
Expand Down Expand Up @@ -72,6 +73,7 @@ public function getFormData(): array

private function handleFormSubmission(): void
{
$this->view_data['form_submitted'] = true;
$form_data = $this->getFormData();

// create a new client object
Expand Down Expand Up @@ -115,7 +117,7 @@ private function handleFormSubmission(): void
Utility::redirect('login');
}

(new Error())->index("An error occurred while processing your registration. Please try again later.");
(new Error())->handleUnknownError();
die();
} else {
$this->loadDataToForm($form_data);
Expand Down Expand Up @@ -148,7 +150,7 @@ private function validateURL(): bool
private function handleInvalidURL(): void
{
if (!$this->validateURL()) {
(new Error())->index("Page not found");
(new Error())->handlePageNotFoundError();
die();
}
}
Expand Down

0 comments on commit 75645d1

Please sign in to comment.