| Server IP : 138.197.176.125 / Your IP : 216.73.217.122 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/googleoffice365SuiteTesting/ |
Upload File : |
<?php
/* +**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
* ********************************************************************************** */
require_once 'includes/main/WebUI.php';
require_once 'include/utils/utils.php';
require_once 'include/utils/VtlibUtils.php';
require_once 'modules/Vtiger/helpers/ShortURL.php';
require_once 'vtlib/Vtiger/Mailer.php';
global $adb;
$adb = PearDatabase::getInstance();
if (isset($_REQUEST['username']) && isset($_REQUEST['emailId'])) {
$username = vtlib_purify($_REQUEST['username']);
$result = $adb->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' => hash('sha256',$username.$time)
)
);
$trackURL = Vtiger_ShortURL_Helper::generateURL($options);
$content = 'Dear Customer,<br><br>
You recently requested a password reset for your VtigerCRM Open source Account.<br>
To create a new password, click on the link <a target="_blank" href='.$trackURL.'>here</a>.
<br><br>
This request was made on '.date("Y-m-d H:i:s").' and will expire in next 1 hour.<br><br>
Regards,<br>
VtigerCRM Open source Support Team.<br>';
$subject = 'Vtiger CRM: Password Reset';
$res = $adb->pquery(
"SELECT ctoffice_outgoingserver_token.token,
ctoffice_outgoingserver_token.display_name,
ctoffice_outgoingserver_token.users_emailid,
ctoffice_outgoingserver_token.refresh_token,
ctoffice_outgoingserver_token.token_expires_in,
ctoffice_outgoingserver_token.user_id
FROM ctoffice_outgoingserver_token LIMIT 1",
array());
$isOutlookConnected = ($adb->num_rows($res) > 0);
if ($isOutlookConnected) {
$outlookAccessToken = $adb->query_result($res, 0, 'token');
$outlookDisplayName = $adb->query_result($res, 0, 'display_name');
$outlookFromEmail = $adb->query_result($res, 0, 'users_emailid');
$outlookRefreshToken = $adb->query_result($res, 0, 'refresh_token');
$expiresAt = $adb->query_result($res, 0, 'token_expires_in');
$OutgoingUserId = $adb->query_result($res, 0, 'user_id');
require_once 'modules/Emails/GraphOutlook.php';
$outlookConnector = new Emails_GraphOutlook($outlookAccessToken);
$status = $outlookConnector->sendMailViaOutlook($outlookFromEmail,$outlookDisplayName,$email,'','',$subject,$content,'',base64_encode($fullMimeContent));
}else{
$mail = new Vtiger_Mailer();
$mail->IsHTML();
$mail->Body = $content;
$mail->Subject = $subject;
$mail->AddAddress($email);
// ensure default sender if not coming from outgoing server
if (!$mail->From) {
global $HELPDESK_SUPPORT_EMAIL_ID;
// use only when config val is valid
if (strpos($HELPDESK_SUPPORT_EMAIL_ID, "@") !== false) {
$mail->From = $HELPDESK_SUPPORT_EMAIL_ID;
}
}
$status = $mail->Send(true);
}
if ($status === 1 || $status === true) {
header('Location: index.php?modules=Users&view=Login&mailStatus=success');
} else {
header('Location: index.php?modules=Users&view=Login&error=statusError');
}
} else {
header('Location: index.php?modules=Users&view=Login&error=fpError');
}
}
?>