ActionController: Allow controllers to customize the login route

This commit is contained in:
Johannes Meyer 2017-05-19 08:39:11 +02:00
parent a4a0f9f5e6
commit 8a890a4a82

View File

@ -41,6 +41,11 @@ use Icinga\Web\Window;
*/ */
class ActionController extends Zend_Controller_Action class ActionController extends Zend_Controller_Action
{ {
/**
* The login route to use when requiring authentication
*/
const LOGIN_ROUTE = 'authentication/login';
/** /**
* Whether the controller requires the user to be authenticated * Whether the controller requires the user to be authenticated
* *
@ -370,7 +375,7 @@ class ActionController extends Zend_Controller_Action
*/ */
protected function redirectToLogin($redirect = null) protected function redirectToLogin($redirect = null)
{ {
$login = Url::fromPath('authentication/login'); $login = Url::fromPath(static::LOGIN_ROUTE);
if ($this->isXhr()) { if ($this->isXhr()) {
if ($redirect !== null) { if ($redirect !== null) {
$login->setParam('redirect', '__SELF__'); $login->setParam('redirect', '__SELF__');