Skip to content
Snippets Groups Projects
Commit bda2e422 authored by Jared Hancock's avatar Jared Hancock
Browse files

If you're logged in as a client, stay that way

When following a link from an email, if you are already signed in to the
help desk as a client, you should just be redirected to the new ticket.
parent 30f91280
No related branches found
No related tags found
No related merge requests found
......@@ -149,6 +149,10 @@ abstract class TicketUser {
return $this->_guest;
}
function getUserId() {
return $this->user->getId();
}
abstract function getTicketId();
abstract function getTicket();
}
......
......@@ -16,14 +16,23 @@
**********************************************************************/
require_once('client.inc.php');
$errors = array();
// Check if the client is already signed in. Don't corrupt their session!
if ($_GET['auth']
&& $thisclient
&& ($u = TicketUser::lookupByToken($_GET['auth']))
&& ($u->getUserId() == $thisclient->getId())
) {
Http::redirect('tickets.php?id='.$u->getTicketId());
}
// Try autologin the user
// Authenticated user can be of type ticket owner or collaborator
$errors = array();
if (isset($_GET['auth']) || isset($_GET['t']))
elseif (isset($_GET['auth']) || isset($_GET['t'])) {
// TODO: Consider receiving an AccessDenied object
$user = UserAuthenticationBackend::processSignOn($errors, false);
}
if ($user && $user->getTicketId())
if (@$user && is_object($user) && $user->getTicketId())
Http::redirect('tickets.php?id='.$user->getTicketId());
$nav = new UserNav();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment