diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index d8e340907..13809e83d 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -254,18 +254,23 @@ class ActionController extends Zend_Controller_Action * * @throws \Exception */ - protected function redirectToLogin($afterLogin = '/dashboard') + protected function redirectToLogin($afterLogin = null) { - if (! $afterLogin instanceof Url) { - $afterLogin = Url::fromPath($afterLogin); - } - if ($this->isXhr()) { - $redir = '__SELF__'; - } else { - // TODO: Ignore /? - $redir = $afterLogin->getRelativeUrl(); + $redir = null; + if ($afterLogin !== null) { + if (! $afterLogin instanceof Url) { + $afterLogin = Url::fromPath($afterLogin); + } + if ($this->isXhr()) { + $redir = '__SELF__'; + } else { + // TODO: Ignore /? + $redir = $afterLogin->getRelativeUrl(); + } } + $url = Url::fromPath('authentication/login'); + if ($redir) { $url->setParam('redirect', $redir); }