|
@@ -1,5 +1,7 @@
|
|
|
<?php /** @noinspection PhpUnhandledExceptionInspection */
|
|
<?php /** @noinspection PhpUnhandledExceptionInspection */
|
|
|
|
|
|
|
|
|
|
+use Carbon\CarbonImmutable;
|
|
|
|
|
+
|
|
|
if(Core::$user) HTTP::redirect("/account");
|
|
if(Core::$user) HTTP::redirect("/account");
|
|
|
|
|
|
|
|
$page_title = __("Register");
|
|
$page_title = __("Register");
|
|
@@ -49,6 +51,10 @@ try {
|
|
|
$secondary_user_address->postal_code = HTTP::value("secondary_postal_code");
|
|
$secondary_user_address->postal_code = HTTP::value("secondary_postal_code");
|
|
|
$secondary_user_address->country = HTTP::value("country");
|
|
$secondary_user_address->country = HTTP::value("country");
|
|
|
|
|
|
|
|
|
|
+ $question = (string) HTTP::value("question");
|
|
|
|
|
+
|
|
|
|
|
+ $dt_now = CarbonImmutable::now(TIMEZONE);
|
|
|
|
|
+
|
|
|
// Referrer
|
|
// Referrer
|
|
|
$referrer_id = HTTP::value("r", "int");
|
|
$referrer_id = HTTP::value("r", "int");
|
|
|
$referrer = User::get($referrer_id);
|
|
$referrer = User::get($referrer_id);
|
|
@@ -66,6 +72,7 @@ try {
|
|
|
|
|
|
|
|
if(empty($user_address->postal_code)) $form_exception->addError(__("Postal code is required."));
|
|
if(empty($user_address->postal_code)) $form_exception->addError(__("Postal code is required."));
|
|
|
if(empty($user_address->country)) $form_exception->addError(__("Country is required."));
|
|
if(empty($user_address->country)) $form_exception->addError(__("Country is required."));
|
|
|
|
|
+ if($question !== $dt_now->format("j")) $form_exception->addError(__("Answer to the question was incorrect."));
|
|
|
|
|
|
|
|
$email_exists = User::query(["email" => $user->email]);
|
|
$email_exists = User::query(["email" => $user->email]);
|
|
|
if($email_exists) $form_exception->addError(__("Email address is already registered."));
|
|
if($email_exists) $form_exception->addError(__("Email address is already registered."));
|