Skip to content

Commit

Permalink
IndexController: ensure successful login after entering incorrect use…
Browse files Browse the repository at this point in the history
…rname

- Return user to login form after failed login and ensure
post variables are cleared.

- Return user to site root after logout, which fixes
redirect loop when using REMOTE_USER and logging out.

fixes #268, #269
  • Loading branch information
steveblamey committed Nov 2, 2023
1 parent bf844c9 commit 480171f
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions modules/public_pages/login/controllers/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ public function login()
$flash->addError('Incorrect username or password');
$this->logger->warning('FAILED LOGIN, Incorrect username or password, or user access disabled', array('username' => $this->username));
}
$this->index();
$this->_templateName = $this->getTemplateName('index');
sendTo('index');
exit();
}

/**
Expand Down Expand Up @@ -458,11 +458,6 @@ public function requestpassword()
}
}

function __call($func, $args)
{
$this->_templateName = $this->getTemplateName('index');
return $this->index();
}

function logout()
{
Expand All @@ -479,14 +474,6 @@ function logout()
//remove session cookie
addCookie(session_name(), '', 0);

// don't go to login form for non-interactive logins
$injector = $this->_injector;
$authentication = $injector->Instantiate('LoginHandler');
if (! $authentication->interactive()) {
$this->_templateName = $this->getTemplateName('logout');
return $this->index();
}

header("Location: /");
exit();
}
Expand Down

0 comments on commit 480171f

Please sign in to comment.