Autologin: Do not require a bogus password in the source code

This commit is contained in:
Eric Lippmann 2014-06-11 15:04:15 +02:00
parent 63fc8eb27e
commit 7215ba4f59
2 changed files with 3 additions and 4 deletions

View File

@ -63,8 +63,6 @@ class AuthenticationController extends ActionController
$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');
$user = new User('');
$password = '';
try { try {
$redirectUrl = Url::fromPath($this->_request->getParam('redirect', 'dashboard')); $redirectUrl = Url::fromPath($this->_request->getParam('redirect', 'dashboard'));
@ -95,9 +93,10 @@ class AuthenticationController extends ActionController
if ($this->getRequest()->isGet()) { if ($this->getRequest()->isGet()) {
$user = new User('');
foreach ($chain as $backend) { foreach ($chain as $backend) {
if ($backend instanceof AutoLoginBackend) { if ($backend instanceof AutoLoginBackend) {
$authenticated = $backend->authenticate($user, $password); $authenticated = $backend->authenticate($user);
if ($authenticated === true) { if ($authenticated === true) {
$auth->setAuthenticated($user); $auth->setAuthenticated($user);
$this->redirectNow($redirectUrl); $this->redirectNow($redirectUrl);

View File

@ -75,7 +75,7 @@ class AutoLoginBackend extends UserBackend
* *
* @return bool * @return bool
*/ */
public function authenticate(User $user, $password) public function authenticate(User $user, $password = null)
{ {
return $this->hasUser($user); return $this->hasUser($user);
} }