#30 Only validate emails if the help desk is configured to do so

This commit is contained in:
Mike Koch 2015-01-01 14:13:11 -05:00
parent 94b2b97994
commit efce82d1d6
2 changed files with 26 additions and 16 deletions

View File

@ -24,3 +24,6 @@ $modsForHesk_settings['maintenance_mode'] = 0;
//-- Set this to 1 to enable custom field names as keys //-- Set this to 1 to enable custom field names as keys
$modsForHesk_settings['custom_field_setting'] = 0; $modsForHesk_settings['custom_field_setting'] = 0;
//-- Set this to 1 to enable email verification for new customers
$modsForHesk_settings['customer_email_verification_required'] = 0;

View File

@ -37,6 +37,7 @@ define('HESK_PATH','./');
// Get all the required files and functions // Get all the required files and functions
require(HESK_PATH . 'hesk_settings.inc.php'); require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'modsForHesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/common.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
require(HESK_PATH . 'inc/email_functions.inc.php'); require(HESK_PATH . 'inc/email_functions.inc.php');
@ -360,11 +361,14 @@ if ($hesk_settings['attachments']['use'] && ! empty($attachments) )
} }
} }
// Check to see if the email address of the user is verified. If not, add the ticket to the stage_ticket table and send verification email // Should the helpdesk validate emails?
$verifiedEmailSql = "SELECT `Email` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."verified_emails` WHERE `Email` = '".hesk_dbEscape($tmpvar['email'])."'"; $createTicket = true;
$verifiedEmailRS = hesk_dbQuery($verifiedEmailSql); if ($modsForHesk_settings['customer_email_verification_required'])
if ($verifiedEmailRS->num_rows == 0)
{ {
$verifiedEmailSql = "SELECT `Email` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."verified_emails` WHERE `Email` = '".hesk_dbEscape($tmpvar['email'])."'";
$verifiedEmailRS = hesk_dbQuery($verifiedEmailSql);
if ($verifiedEmailRS->num_rows == 0)
{
//-- email has not yet been verified. //-- email has not yet been verified.
$ticket = hesk_newTicket($tmpvar, false); $ticket = hesk_newTicket($tmpvar, false);
@ -379,7 +383,10 @@ if ($verifiedEmailRS->num_rows == 0)
require(HESK_PATH . 'inc/email_functions.inc.php'); require(HESK_PATH . 'inc/email_functions.inc.php');
hesk_notifyCustomer('verify_email'); hesk_notifyCustomer('verify_email');
} else $createTicket = false;
}
}
if ($createTicket)
{ {
//-- email has been verified, and a ticket can be created //-- email has been verified, and a ticket can be created
$ticket = hesk_newTicket($tmpvar); $ticket = hesk_newTicket($tmpvar);