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:
@@ -32,25 +32,4 @@ class AdminController extends Controller
|
||||
|
||||
Redirect::to("admin");
|
||||
}
|
||||
|
||||
public function registerUser()
|
||||
{
|
||||
// Ensure the user is logged in and is an admin
|
||||
if (!LoginModel::isUserLoggedIn() || !LoginModel::isAdmin()) {
|
||||
Session::add('feedback_negative', Text::get('FEEDBACK_ADMIN_ONLY'));
|
||||
Redirect::to('admin/index');
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate and register the new user
|
||||
$registration_successful = RegistrationModel::registerNewUser(true);
|
||||
|
||||
if ($registration_successful) {
|
||||
Session::add('feedback_positive', Text::get('FEEDBACK_USER_REGISTERED_SUCCESSFULLY'));
|
||||
} else {
|
||||
Session::add('feedback_negative', Text::get('FEEDBACK_USER_REGISTRATION_FAILED'));
|
||||
}
|
||||
|
||||
Redirect::to('admin/index');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user