mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 13:54:26 +02:00
parent
571351e342
commit
ec2ffcabdf
@ -80,7 +80,12 @@ class AuthenticationController extends ActionController
|
|||||||
$this->view->form->getElement('password')
|
$this->view->form->getElement('password')
|
||||||
->addError(t('Please provide a valid username and password'));
|
->addError(t('Please provide a valid username and password'));
|
||||||
} else {
|
} else {
|
||||||
|
$redirectUrl = $this->_request->getParam('redirect');
|
||||||
|
if ($redirectUrl == null) {
|
||||||
$this->redirectNow('index?_render=body');
|
$this->redirectNow('index?_render=body');
|
||||||
|
} else {
|
||||||
|
$this->redirectNow($redirectUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ConfigurationError $configError) {
|
} catch (ConfigurationError $configError) {
|
||||||
@ -98,7 +103,7 @@ class AuthenticationController extends ActionController
|
|||||||
));
|
));
|
||||||
$this->replaceLayout = true;
|
$this->replaceLayout = true;
|
||||||
$auth->removeAuthorization();
|
$auth->removeAuthorization();
|
||||||
$this->redirect('login');
|
$this->redirectToLogin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
@ -102,7 +102,7 @@ class ActionController extends Zend_Controller_Action
|
|||||||
$this->view->tabs = new Tabs();
|
$this->view->tabs = new Tabs();
|
||||||
$this->init();
|
$this->init();
|
||||||
} else {
|
} else {
|
||||||
$this->redirectToLogin();
|
$this->redirectToLogin($this->getRequestUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,8 +164,12 @@ class ActionController extends Zend_Controller_Action
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect to the login path
|
* Redirect to the login path
|
||||||
|
*
|
||||||
|
* @param string $afterLogin The action to call when the login was successful. Defaults to '/index/welcome'
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private function redirectToLogin()
|
protected function redirectToLogin($afterLogin = '/index/welcome')
|
||||||
{
|
{
|
||||||
if ($this->getRequest()->isXmlHttpRequest()) {
|
if ($this->getRequest()->isXmlHttpRequest()) {
|
||||||
|
|
||||||
@ -174,9 +178,22 @@ class ActionController extends Zend_Controller_Action
|
|||||||
throw new Exception("You are not logged in");
|
throw new Exception("You are not logged in");
|
||||||
}
|
}
|
||||||
$url = Url::fromPath('/authentication/login');
|
$url = Url::fromPath('/authentication/login');
|
||||||
|
$url->setParam('redirect', $afterLogin);
|
||||||
$this->redirectNow($url->getRelativeUrl());
|
$this->redirectNow($url->getRelativeUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the URI that can be used to request the current action
|
||||||
|
*
|
||||||
|
* @return string return the path to this action: <Module>/<Controller>/<Action>
|
||||||
|
*/
|
||||||
|
public function getRequestUrl()
|
||||||
|
{
|
||||||
|
return $this->_request->getModuleName() . '/' .
|
||||||
|
$this->_request->getControllerName() . '/' .
|
||||||
|
$this->_request->getActionName();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect to a specific url, updating the browsers URL field
|
* Redirect to a specific url, updating the browsers URL field
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user