diff options
Diffstat (limited to 'includes/form/RegisterForm.php')
-rw-r--r-- | includes/form/RegisterForm.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/includes/form/RegisterForm.php b/includes/form/RegisterForm.php index 4967048..c1c1966 100644 --- a/includes/form/RegisterForm.php +++ b/includes/form/RegisterForm.php @@ -53,4 +53,20 @@ class RegisterForm extends Form return $result; } + + public function validate_invite_code($invite_code): ?string + { + $result = null; + + if (empty($invite_code)) { + $this->report_error("You need an invite code to register an account."); + } else { + $result = filter_var($invite_code, FILTER_SANITIZE_STRING); + + if (!User::invite_code_exists($result)) { + $this->report_error("Your invite code is invalid."); + } + } + return $result; + } } |