[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Users/actions/ -> ForgotPassword.php (source)

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

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

   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  chdir(dirname(__FILE__) . "/../../../");
  12  include_once  "include/utils/VtlibUtils.php";
  13  include_once  "include/utils/CommonUtils.php";
  14  include_once  "includes/Loader.php";
  15  include_once  'includes/runtime/BaseModel.php';
  16  include_once  'includes/runtime/Viewer.php';
  17  include_once  "includes/http/Request.php";
  18  include_once  "include/Webservices/Custom/ChangePassword.php";
  19  include_once  "include/Webservices/Utils.php";
  20  include_once  "includes/runtime/EntryPoint.php";
  21  
  22  class Users_ForgotPassword_Action {
  23  
  24      public function changePassword($request) {
  25  
  26          $request = new Vtiger_Request($request);
  27          $viewer = Vtiger_Viewer::getInstance();
  28          $userName = $request->get('username');
  29          $newPassword = $request->get('password');
  30          $confirmPassword = $request->get('confirmPassword');
  31          $shortURLID = $request->get('shorturl_id');
  32          $secretHash = $request->get('secret_hash');
  33          $shortURLModel = Vtiger_ShortURL_Helper::getInstance($shortURLID);
  34          $secretToken = $shortURLModel->handler_data['secret_token'];
  35  
  36          $validateData = array('username' => $userName,
  37              'secret_token' => $secretToken,
  38              'secret_hash' => $secretHash
  39          );
  40          $valid = $shortURLModel->compareEquals($validateData);
  41          if ($valid) {
  42              $userId = getUserId_Ol($userName);
  43              $user = Users::getActiveAdminUser();
  44              $wsUserId = vtws_getWebserviceEntityId('Users', $userId);
  45              vtws_changePassword($wsUserId, '', $newPassword, $confirmPassword, $user);
  46          } else {
  47              $viewer->assign('ERROR', true);
  48          }
  49          $shortURLModel->delete();
  50          $viewer->assign('USERNAME', $userName);
  51          $viewer->assign('PASSWORD', $newPassword);
  52          $viewer->view('FPLogin.tpl', 'Users');
  53      }
  54  
  55      public static function run($request) {
  56          $instance = new self();
  57          $instance->changePassword($request);
  58      }
  59  
  60  }
  61  
  62  Users_ForgotPassword_Action::run($_REQUEST);


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