diff --git a/src/classes/wishthis/Page.php b/src/classes/wishthis/Page.php index 43e89409..bfe9feba 100644 --- a/src/classes/wishthis/Page.php +++ b/src/classes/wishthis/Page.php @@ -507,7 +507,7 @@ class Page 'icon' => 'sign out alternate', ]; } else { - $pages[$login] = [ + $pages[$login] = [ 'text' => __('Login'), 'alignment' => 'right', 'items' => [ @@ -518,17 +518,22 @@ class Page ], ], ]; - $pages[$register] = [ - 'text' => __('Register'), - 'alignment' => 'right', - 'items' => [ - [ - 'text' => __('Register'), - 'url' => Page::PAGE_REGISTER, - 'icon' => 'user plus alternate', + + $registrationDisabled = defined('DISABLE_USER_REGISTRATION') && true === DISABLE_USER_REGISTRATION; + + if (!$registrationDisabled) { + $pages[$register] = [ + 'text' => __('Register'), + 'alignment' => 'right', + 'items' => [ + [ + 'text' => __('Register'), + 'url' => Page::PAGE_REGISTER, + 'icon' => 'user plus alternate', + ], ], - ], - ]; + ]; + } } if (100 === $user->getPower()) { diff --git a/src/pages/register.php b/src/pages/register.php index 904daa8c..8d1936cb 100644 --- a/src/pages/register.php +++ b/src/pages/register.php @@ -8,14 +8,15 @@ namespace wishthis; -$passwordReset = isset($_GET['password-reset'], $_GET['token']); +$passwordReset = isset($_GET['password-reset'], $_GET['token']); +$registrationDisabled = defined('DISABLE_USER_REGISTRATION') && true === DISABLE_USER_REGISTRATION; $pageTitle = $passwordReset ? __('Reset password') : __('Register'); $buttonSubmit = $passwordReset ? __('Reset') : __('Register'); $page = new Page(__FILE__, $pageTitle); -if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) { +if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet']) && !$registrationDisabled) { $users = $database ->query( 'SELECT * @@ -115,14 +116,6 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) { $locale_user = $locale_browser; } - if (defined('DISABLE_USER_REGISTRATION') && true === DISABLE_USER_REGISTRATION) { - \http_response_code(403); - - die(__('The owner of this site has disabled user registrations.')); - - return; - } - /** * Register */ @@ -221,17 +214,11 @@ $page->navigation(); = $page->messages() ?> - +
= __('The owner of this site has disabled user registrations.') ?>
+The owner of this instance has disabled user registration.