Fixed admin panel user registration.

Now including start.sh to start a php server using the router.php so no webserver is needed.
This commit is contained in:
2025-12-03 08:10:38 +01:00
parent 3a99bd6683
commit 1a30c45d62
9 changed files with 49 additions and 94 deletions

View File

@@ -22,12 +22,8 @@ class RegisterController extends Controller
*/
public function index()
{
// Redirect non-logged-in users to the login page
if (!LoginModel::isUserLoggedIn()) {
Redirect::to('login/index');
return;
}
// only admins can access registration; reuse existing admin auth check
Auth::checkAdminAuthentication();
$this->View->render('register/index');
}
@@ -37,20 +33,12 @@ class RegisterController extends Controller
*/
public function register_action()
{
// Restrict registration to admins only
if (!LoginModel::isAdmin()) {
Session::add('feedback_negative', Text::get('FEEDBACK_ADMIN_ONLY'));
Redirect::to('login/index');
return;
}
// enforce admin-only for registration
Auth::checkAdminAuthentication();
$registration_successful = RegistrationModel::registerNewUser();
RegistrationModel::registerNewUser();
if ($registration_successful) {
Redirect::to('login/index');
} else {
Redirect::to('register/index');
}
Redirect::to('admin/index');
}
/**
@@ -76,7 +64,7 @@ class RegisterController extends Controller
*/
public function showCaptcha()
{
Session::add('feedback_negative', Text::get('FEEDBACK_CAPTCHA_NOT_USED'));
// Captcha no longer used
Redirect::to('register/index');
}
}