From f3fccbc9516e7b0b3f8aa9099f6d96e768693df6 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Tue, 2 Oct 2012 23:05:24 -0400
Subject: [PATCH] Try auto-login ONLY if params exists change tryLogin to
 simply login

---
 include/class.client.php | 2 +-
 login.php                | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/class.client.php b/include/class.client.php
index 5c5f3035e..8b0a4dbee 100644
--- a/include/class.client.php
+++ b/include/class.client.php
@@ -134,7 +134,7 @@ class Client {
         return (($id=self::getLastTicketIdByEmail($email)))?self::lookup($id, $email):null;
     }
 
-    /* static */ function tryLogin($ticketID, $email, $auth=null) {
+    /* static */ function login($ticketID, $email, $auth=null) {
         global $ost;
         $cfg = $ost->getConfig();
 
diff --git a/login.php b/login.php
index f35693fd4..560f88d9d 100644
--- a/login.php
+++ b/login.php
@@ -21,8 +21,10 @@ define('OSTCLIENTINC',TRUE); //make includes happy
 require_once(INCLUDE_DIR.'class.client.php');
 require_once(INCLUDE_DIR.'class.ticket.php');
 
-if ($_POST) ClientSession::tryLogin($_POST['lticket'], $_POST['lemail']);
-else ClientSession::tryLogin($_GET['t'], $_GET['e'], $_GET['a']);
+if ($_POST)
+    Client::login($_POST['lticket'], $_POST['lemail']);
+elseif($_GET['t'] && $_GET['e'] && $_GET['a'])
+    Client::login($_GET['t'], $_GET['e'], $_GET['a']);
 
 $nav = new UserNav();
 $nav->setActiveNav('status');
-- 
GitLab