[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/ -> forgotPassword.php (source)

   1  <?php
   2  
   3  /* +**********************************************************************************

   4   * The contents of this file are subject to the vtiger CRM Public License Version 1.1

   5   * ("License"); You may not use this file except in compliance with the License

   6   * The Original Code is:  vtiger CRM Open Source

   7   * The Initial Developer of the Original Code is vtiger.

   8   * Portions created by vtiger are Copyright (C) vtiger.

   9   * All Rights Reserved.

  10   * ********************************************************************************** */
  11  require_once  'include/utils/utils.php';
  12  require_once  'include/utils/VtlibUtils.php';
  13  require_once  'modules/Emails/class.phpmailer.php';
  14  require_once  'modules/Emails/mail.php';
  15  require_once  'modules/Vtiger/helpers/ShortURL.php';
  16  global $adb;
  17  $adb = PearDatabase::getInstance();
  18  
  19  if (isset($_REQUEST['user_name']) && isset($_REQUEST['emailId'])) {
  20      $username = vtlib_purify($_REQUEST['user_name']);
  21      $result = $adb->pquery('select email1 from vtiger_users where user_name= ? ', array($username));
  22      if ($adb->num_rows($result) > 0) {
  23          $email = $adb->query_result($result, 0, 'email1');
  24      }
  25  
  26      if (vtlib_purify($_REQUEST['emailId']) == $email) {
  27          $time = time();
  28          $options = array(
  29              'handler_path' => 'modules/Users/handlers/ForgotPassword.php',
  30              'handler_class' => 'Users_ForgotPassword_Handler',
  31              'handler_function' => 'changePassword',
  32              'handler_data' => array(
  33                  'username' => $username,
  34                  'email' => $email,
  35                  'time' => $time,
  36                  'hash' => md5($username . $time)
  37              )
  38          );
  39          $trackURL = Vtiger_ShortURL_Helper::generateURL($options);
  40          $content = 'Dear Customer,<br><br> 
  41                              You recently requested a password reset for your VtigerCRM Open source Account.<br> 
  42                              To create a new password, click on the link <a target="_blank" href=' . $trackURL . '>here</a>. 
  43                              <br><br> 
  44                              This request was made on ' . date("Y-m-d H:i:s") . ' and will expire in next 24 hours.<br><br> 
  45                      Regards,<br> 
  46                      VtigerCRM Open source Support Team.<br>' ;
  47                  $mail = new PHPMailer();
  48          setMailerProperties($mail, 'Request : ForgotPassword - vtigercrm', $content, '[email protected]', $username, $email);
  49          $status = MailSend($mail);
  50          if ($status === 1)
  51              header('Location:  index.php?modules=Users&view=Login&status=1');
  52          else
  53              header('Location:  index.php?modules=Users&view=Login&statusError=1');
  54      } else {
  55          header('Location:  index.php?modules=Users&view=Login&fpError=1');
  56      }
  57  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1