From 17725ca51416bc1f7905c4ab0b27d9605df57dfe Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 6 Mar 2014 14:40:56 -0600 Subject: [PATCH] client: Don't show all tickets if already logged in If a client is already logged into the system and follows a second ticket link, show the ticket instead of the list of tickets. --- scp/login.php | 3 ++- view.php | 15 ++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/scp/login.php b/scp/login.php index 4356aaa61..20f53938e 100644 --- a/scp/login.php +++ b/scp/login.php @@ -29,7 +29,8 @@ if($_POST) { $username = trim($_POST['userid']); if ($user = StaffAuthenticationBackend::process($username, $_POST['passwd'], $errors)) { - @header("Location: $dest"); + session_write_close(); + Http::redirect($dest); require_once('index.php'); //Just incase header is messed up. exit; } diff --git a/view.php b/view.php index 2398fff56..b8590aab4 100644 --- a/view.php +++ b/view.php @@ -16,16 +16,13 @@ **********************************************************************/ require_once('client.inc.php'); +// Try autologin the user +// Authenticated user can be of type ticket owner or collaborator +$errors = array(); +$user = UserAuthenticationBackend::processSignOn($errors); +if ($user && $user->getTicketId()) + Http::redirect('tickets.php?id='.$user->getTicketId()); -//If the user is NOT logged in - try auto-login (if params exists). -if (!$thisclient || !$thisclient->isValid()) { - // Try autologin the user - // Authenticated user can be of type ticket owner or collaborator - $errors = array(); - $user = UserAuthenticationBackend::processSignOn($errors); - if ($user && $user->getTicketId()) - @header('Location: tickets.php?id='.$user->getTicketId()); -} //Simply redirecting to tickets.php until multiview is implemented. require('tickets.php'); ?> -- GitLab