forked from Public/pics
Invoke Dispatcher::kickGuest from Session for invalid sessions.
Previously, a NotAllowedException would be thrown if an invalid session was encountered. However, these exceptions were not caught, and hence would yield a fatal uncaught exception error. At this point in Kabuki, the ErrorHandler class has not been registered yet for error handling purposes. This error is therefore not visible if the PHP ini directive 'display_errors' is set to 'Off'. As this is the default production value, the script would fail with a blank page in such cases.
This commit is contained in:
@@ -114,10 +114,10 @@ class Dispatcher
|
||||
/**
|
||||
* Kicks a guest to a login form, redirecting them back to this page upon login.
|
||||
*/
|
||||
public static function kickGuest()
|
||||
public static function kickGuest($title = null, $message = null)
|
||||
{
|
||||
$form = new LogInForm('Log in');
|
||||
$form->adopt(new Alert('', 'You need to be logged in to view this page.', 'error'));
|
||||
$form->adopt(new Alert($title ?? '', $message ?? 'You need to be logged in to view this page.', 'error'));
|
||||
$form->setRedirectUrl($_SERVER['REQUEST_URI']);
|
||||
|
||||
$page = new MainTemplate('Login required');
|
||||
|
||||
Reference in New Issue
Block a user