pquery('select email1 from vtiger_users where user_name= ? ', array($username));
if ($adb->num_rows($result) > 0) {
$email = $adb->query_result($result, 0, 'email1');
}
if (vtlib_purify($_REQUEST['emailId']) == $email) {
$time = time();
$options = array(
'handler_path' => 'modules/Users/handlers/ForgotPassword.php',
'handler_class' => 'Users_ForgotPassword_Handler',
'handler_function' => 'changePassword',
'handler_data' => array(
'username' => $username,
'email' => $email,
'time' => $time,
'hash' => md5($username . $time)
)
);
$trackURL = Vtiger_ShortURL_Helper::generateURL($options);
$content = 'Dear Customer,
You recently requested a password reset for your VtigerCRM Open source Account.
To create a new password, click on the link here.
This request was made on ' . date("Y-m-d H:i:s") . ' and will expire in next 24 hours.
Regards,
VtigerCRM Open source Support Team.
' ;
$mail = new PHPMailer();
setMailerProperties($mail, 'Request : ForgotPassword - vtigercrm', $content, 'support@vtiger.com', $username, $email);
$status = MailSend($mail);
if ($status === 1)
header('Location: index.php?modules=Users&view=Login&status=1');
else
header('Location: index.php?modules=Users&view=Login&statusError=1');
} else {
header('Location: index.php?modules=Users&view=Login&fpError=1');
}
}