Hi all,
I'm a new osTicket user but am quite experienced in php.
I too wanted to restrict ticket posting and adopted a quick fix approach as follows:
Hard coded acceptable email domains (not specific addresses)
Look up where necessary
For the record, these are the changes:
// osTicket version 1.6RC4
// Backup file: include/class.client.php
// Open file: include/class.client.php
// Find
// if($email){ //don't validate...using whatever is entered.
// $sql.=' AND email='.db_input($email);
// }
// Replace with
if( !$this->knownEmailDomain($email) ){ //validate by email domain
return NULL;
}
$sql.=' AND email='.db_input($email);
// Find
// function getId(){
// Add before
function knownEmailDomain($email){
$domains = array(
'xxxxxx.com',
'yyyyyyy.net',
'zzzz.org'
);
$a = explode('@', $email);
return in_array($a, $domains);
}
// Close file
// Backup file: open.php
// Open file: open.php
// Find
// if($_POST):
// Add after
if(!Client:($_POST)){
$errors = 'Unable to create a ticket. Please correct errors below and try again!';
$errors = 'Only pre-validated email addresses are allowed.';
}
// Close file
Only lightly tested so please treat with caution.
Of course, you can only add/remove via FTP - there's no friendly control panel.
The osTicket code is VERY well organised so changes like this are pretty easy once you've learned the patterns and conventions.
Hopefully mods like this will be a thing of the past soon, when proper user
login is introduced.
Meanwhile I hope this helps.
Clipper