Skip to content
Snippets Groups Projects
Commit fffc218a authored by Demian Katz's avatar Demian Katz
Browse files

Made directory structure consistent with namespaces.

parent 31cee325
No related merge requests found
Showing
with 24 additions and 2 deletions
......@@ -55,6 +55,7 @@ authentication_error_admin = "We cannot log you in at this time. Please contact
authentication_error_blank = "Login information cannot be blank."
authentication_error_denied = "Credentials do not match! Access denied."
authentication_error_invalid = "Invalid login -- please try again."
authentication_error_loggedout = "You have logged out."
authentication_error_technical = "We cannot log you in at this time. Please try again later."
Author = Author
Author Browse = "Author Browse"
......
......@@ -199,6 +199,7 @@ class Manager implements ServiceLocatorAwareInterface
// Clear out the cached user object and session entry.
$this->currentUser = false;
unset($this->session->userId);
setcookie('loggedOut', 1, null, '/');
// Destroy the session for good measure, if requested.
if ($destroy) {
......@@ -213,6 +214,16 @@ class Manager implements ServiceLocatorAwareInterface
return $url;
}
/**
* Checks whether the user has recently logged out.
*
* @return bool
*/
public function userHasLoggedOut()
{
return isset($_COOKIE['loggedOut']) && $_COOKIE['loggedOut'];
}
/**
* Checks whether the user is logged in.
*
......@@ -258,6 +269,7 @@ class Manager implements ServiceLocatorAwareInterface
{
$this->currentUser = $user;
$this->session->userId = $user->id;
setcookie('loggedOut', '', time() - 3600, '/'); // clear logged out cookie
}
/**
......
......@@ -58,8 +58,17 @@ class MyResearchController extends AbstractBase
try {
$this->getAuthManager()->login($this->getRequest());
} catch (AuthException $e) {
$this->flashMessenger()->setNamespace('error')
->addMessage($e->getMessage());
$msg = $e->getMessage();
// If a Shibboleth-style login has failed and the user just logged
// out, we need to override the error message with a more relevant
// one:
if ($msg == 'authentication_error_admin'
&& $this->getAuthManager()->userHasLoggedOut()
&& $this->getSessionInitiator()
) {
$msg = 'authentication_error_loggedout';
}
$this->flashMessenger()->setNamespace('error')->addMessage($msg);
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment