#30 Some fixes for verify email.

- Actually add the email to the verified_emails table
 - Pass in the $ticket variable to add the customer's name to the email
 - Actually call the correct email function.
merge-requests/2/head
Mike Koch 9 years ago
parent 13953d5627
commit 6e84309289

@ -56,8 +56,8 @@ function hesk_notifyCustomerForVerifyEmail($email_template = 'verify_email', $ac
} }
// Format email subject and message // Format email subject and message
$subject = hesk_getEmailSubject($email_template); $subject = hesk_getEmailSubject($email_template, $ticket);
$message = hesk_getEmailMessage($email_template, null, 0, 0, 0); $message = hesk_getEmailMessage($email_template, $ticket);
$activationUrl = $hesk_settings['hesk_url'] . '/verifyemail.php?key=%%ACTIVATIONKEY%%'; $activationUrl = $hesk_settings['hesk_url'] . '/verifyemail.php?key=%%ACTIVATIONKEY%%';
$message = str_replace('%%VERIFYURL%%', $activationUrl, $message); $message = str_replace('%%VERIFYURL%%', $activationUrl, $message);
$message = str_replace('%%ACTIVATIONKEY%%', $activationKey, $message); $message = str_replace('%%ACTIVATIONKEY%%', $activationKey, $message);
@ -244,6 +244,9 @@ function hesk_validEmails()
// --> Ticket closed // --> Ticket closed
'ticket_closed' => $hesklang['ticket_closed'], 'ticket_closed' => $hesklang['ticket_closed'],
// --> Verify email
'verify_email' => $hesklang['verify_email'],
/*** Emails sent to STAFF ***/ /*** Emails sent to STAFF ***/

@ -374,15 +374,14 @@ if ($modsForHesk_settings['customer_email_verification_required'])
//-- generate the activation key, which is a hash of their email address along with the current time. //-- generate the activation key, which is a hash of their email address along with the current time.
$unhashedKey = $tmpvar['email'].time(); $unhashedKey = $tmpvar['email'].time();
$key = hash('sha512', $unhashed); $key = hash('sha512', $unhashedKey);
$escapedEmail = hesk_dbEscape($tmpvar['email']); $escapedEmail = hesk_dbEscape($tmpvar['email']);
$escapedKey = hesk_dbEscape($key); $escapedKey = hesk_dbEscape($key);
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."pending_verification_emails` (`Email`, `ActivationKey`) hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."pending_verification_emails` (`Email`, `ActivationKey`)
VALUES ('".$escapedEmail."', '".$escapedKey."')"); VALUES ('".$escapedEmail."', '".$escapedKey."')");
require(HESK_PATH . 'inc/email_functions.inc.php'); hesk_notifyCustomerForVerifyEmail('verify_email', $key);
hesk_notifyCustomer('verify_email');
$createTicket = false; $createTicket = false;
} }
} }

@ -8,6 +8,7 @@ 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/posting_functions.inc.php'); require(HESK_PATH . 'inc/posting_functions.inc.php');
require(HESK_PATH . 'inc/email_functions.inc.php');
require_once(HESK_PATH . 'inc/header.inc.php'); require_once(HESK_PATH . 'inc/header.inc.php');
?> ?>
<ol class="breadcrumb"> <ol class="breadcrumb">
@ -42,18 +43,20 @@ require_once(HESK_PATH . 'inc/header.inc.php');
WHERE `email` = '".hesk_dbEscape($result['Email'])."'"); WHERE `email` = '".hesk_dbEscape($result['Email'])."'");
while ($innerResult = $ticketRs->fetch_assoc()) while ($innerResult = $ticketRs->fetch_assoc())
{ {
hesk_newTicket($innerResult); $ticket = hesk_newTicket($innerResult);
// Notify the customer // Notify the customer
hesk_notifyCustomer(); hesk_notifyCustomer();
// Need to notify staff? // Need to notify staff?
// --> From autoassign? // --> From autoassign?
if ($tmpvar['owner'] && $autoassign_owner['notify_assigned']) $getOwnerRs = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE ID = ".hesk_dbEscape($ticket['owner']));
$autoassign_owner = $getOwnerRs->fetch_assoc();
if ($ticket['owner'] && $autoassign_owner['notify_assigned'])
{ {
hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you'); hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you');
} }
// --> No autoassign, find and notify appropriate staff // --> No autoassign, find and notify appropriate staff
elseif ( ! $tmpvar['owner'] ) elseif ( ! $ticket['owner'] )
{ {
hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' "); hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' ");
} }
@ -62,11 +65,14 @@ require_once(HESK_PATH . 'inc/header.inc.php');
hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets` hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets`
WHERE `id` = ".$innerResult['id']); WHERE `id` = ".$innerResult['id']);
} }
//Add email address to the verified emails table
hesk_dbQuery('INSERT INTO `'.hesk_dbEscape($hesk_settings['db_pfix']).'verified_emails` (`Email`) VALUES (\''.hesk_dbEscape($email).'\')');
} }
hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."pending_verification_emails` hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."pending_verification_emails`
WHERE `ActivationKey` = '".hesk_dbEscape($key)."'"); WHERE `ActivationKey` = '".hesk_dbEscape($key)."'");
//-- were there an email recored for the key? //-- was there an email recorded for the key?
if (!empty($email)) if (!empty($email))
{ {
$showForm = false; $showForm = false;
@ -77,7 +83,7 @@ require_once(HESK_PATH . 'inc/header.inc.php');
<?php <?php
foreach ($submittedTickets as $ticket) foreach ($submittedTickets as $ticket)
{ {
echo '<li><a href="'.$hesk_settings['hesk_url'].'/ticket.php?track='.$ticket['trackid'].'">'.$ticket.'</a></li>'; echo '<li><a href="'.$hesk_settings['hesk_url'].'/ticket.php?track='.$ticket.'">'.$ticket.'</a></li>';
} }
if (count($submittedTickets) == 0) if (count($submittedTickets) == 0)
{ {

Loading…
Cancel
Save