AuthenticationController: use Auth() helper function

This commit is contained in:
Thomas Gelf 2014-06-22 20:08:55 +02:00
parent 23ed744747
commit 3fc1205175
1 changed files with 3 additions and 5 deletions

View File

@ -32,7 +32,6 @@
use Icinga\Authentication\Backend\AutoLoginBackend; use Icinga\Authentication\Backend\AutoLoginBackend;
use Icinga\Web\Controller\ActionController; use Icinga\Web\Controller\ActionController;
use Icinga\Authentication\Manager as AuthManager;
use Icinga\Form\Authentication\LoginForm; use Icinga\Form\Authentication\LoginForm;
use Icinga\Authentication\AuthChain; use Icinga\Authentication\AuthChain;
use Icinga\Application\Config; use Icinga\Application\Config;
@ -60,6 +59,7 @@ class AuthenticationController extends ActionController
*/ */
public function loginAction() public function loginAction()
{ {
$auth = $this->Auth();
$this->view->form = new LoginForm(); $this->view->form = new LoginForm();
$this->view->form->setRequest($this->_request); $this->view->form->setRequest($this->_request);
$this->view->title = $this->translate('Icingaweb Login'); $this->view->title = $this->translate('Icingaweb Login');
@ -67,8 +67,6 @@ class AuthenticationController extends ActionController
try { try {
$redirectUrl = Url::fromPath($this->params->get('redirect', 'dashboard')); $redirectUrl = Url::fromPath($this->params->get('redirect', 'dashboard'));
$auth = AuthManager::getInstance();
if ($auth->isAuthenticated()) { if ($auth->isAuthenticated()) {
$this->rerenderLayout()->redirectNow($redirectUrl); $this->rerenderLayout()->redirectNow($redirectUrl);
} }
@ -150,7 +148,7 @@ class AuthenticationController extends ActionController
*/ */
public function logoutAction() public function logoutAction()
{ {
$auth = AuthManager::getInstance(); $auth = $this->Auth();
$auth->removeAuthorization(); $auth->removeAuthorization();
if ($auth->isAuthenticatedFromRemoteUser()) { if ($auth->isAuthenticatedFromRemoteUser()) {