AuthenticationController: use Auth() helper function
This commit is contained in:
parent
23ed744747
commit
3fc1205175
|
@ -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,14 +59,13 @@ 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');
|
||||||
|
|
||||||
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()) {
|
||||||
|
|
Loading…
Reference in New Issue