This mod was created because I have clients that move around to different locations and use a generic login at each location. I didn't want them to have to know a particular ticket number to be able to login and check the tickets that are open at each location. I put windows authentication on our server and just deleted the need for a client password or ticket number.
First the work around for ticket number authentication is based on the static function in the class.client.php file getLastTicketIdByEmail($email). This will return a ticket number for authentication without anyone knowing what numbers are out there. Also need to change the view so they see all the open tickets instead of the ticket detail as well as header in login.
OPEN osticket/view.php
FIND:
if($user && $user->getTicketID()==trim($_GET))
<USERMENTION username="header">@header</USERMENTION>('Location: tickets.php?id='.$user->getTicketID());
REPLACE with:
if($user && $user->getTicketID()==trim($_GET))
<USERMENTION username="header">@header</USERMENTION>('Location: tickets.php');
open osticket/login.php FIND:
if(($user=Client:(trim($_POST), trim($_POST), null, $errors))) {
//XXX: Ticket owner is assumed.
<USERMENTION username="header">@header</USERMENTION>('Location: tickets.php?id='.$user->getTicketID());
require_once('tickets.php'); //Just in case of 'header already sent' error.
exit;
} elseif(!$errors) {
$errors = 'Authentication error - try again!';
}
REPLACE with:
//mod client login begin
if(($user=Client:(trim(Client:($_POST)), trim($_POST), null, $errors))) {
//XXX: Ticket owner is assumed.
<USERMENTION username="header">@header</USERMENTION>('Location: tickets.php');
require_once('tickets.php'); //Just in case of 'header already sent' error.
exit;
} //MOD client login end
elseif(!$errors) {
$errors = 'Authentication error - try again!';
}
***NOTE*** if you want to put a password in place change the ticket number variable on the textbox in include/client/login.inc.php to password and wrap the previous code in and if $password =='somepassword' statement. Alternatively you can DELETE the textbox shown in the following code.
OPEN include/client/login.inc.php
FIND:
<div>
<label for="ticketno">Ticket ID:</label>
<input id="ticketno" type="text" name="lticket" size="16" value="<?php echo $ticketid; ?>"></td>
</div>
REPLACE with (or delete previous):
<div>
<label for="password">Password:</label>
<input id="password" type="text" name="lpassword" size="16" value="<?php echo $password; ?>"></td>
</div>
Since my clients use a generic login, I created new distribution groups so people who needed to get ticket updates can receive the emails and be able to login. I don't expect them to remember the distro email for every location so I replaced the textbox where they input an email with a drop down list of all the locations in both the include/client/login.inc.php and include/client/open.inc.php.
OPEN include/client/login.inc.php
FIND:
<div>
<label for="email">E-Mail Address:</label>
<input id="email" type="text" name="lemail" size="30" value="<?php echo $email; ?>">
</div>
REPLACE with:
<div align="right">
<label for="email" >Location: </label>
<select name="lemail" id="email" value="<?php echo $email; ?>">
<option value="" selected >— Select Location —</option>
<option value="email@domain.org" >Location 1</option>
<option value="email@domain.org" >Location 2</option>
</select>
<font class="error">* <?php echo $errors; ?></font>
</div>
OPEN include/client/open.inc.php
FIND:
<?php
if($thisclient && $thisclient->isValid()) {
echo $thisclient->getName();
} else { ?>
<input id="name" type="text" name="name" size="30" value="<?php echo $info; ?>">
<font class="error">* <?php echo $errors; ?></font>
<?php
} ?>
</td>
</tr>
<tr>
<th class="required" width="160">Email Address:</th>
<td>
<?php
if($thisclient && $thisclient->isValid()) {
echo $thisclient->getEmail();
} else { ?>
<input id="email" type="text" name="email" size="30" value="<?php echo $info; ?>">
<font class="error">* <?php echo $errors; ?></font>
<?php
} ?>
REPLACE with:
<input id="name" type="text" name="name" size="30" value="<?php echo $info; ?>">
<font class="error">* <?php echo $errors; ?></font>
</td>
</tr>
<tr>
<th class="required" width="100">Location:</th>
<td>
<select name="email" id="email" value="<?php echo $info; ?>">
<option value="" selected >— Select Location —</option>
<option value="email@domain.org" >Location 1</option>
<option value="email@domain.org" >Location 2</option>
</select>
<font class="error">* <?php echo $errors; ?></font>