Exemple #1
0
 if ($_pgR["act"] == Model_User::ACT_RESET_PASS) {
     $userName = $_pgR['username'];
     $userName = html_entity_decode($userName, ENT_COMPAT, 'UTF-8');
     $email = $_pgR['email'];
     $email = html_entity_decode($email, ENT_COMPAT, 'UTF-8');
     if ($userName) {
         $fieldName = global_mapping::UserName;
         $fieldValue = $userName;
     } else {
         $fieldName = global_mapping::Email;
         $fieldValue = $email;
     }
     $result = $objUser->getUserByField($fieldName, $fieldValue);
     //echo $result;
     if ($result) {
         $guid = $objReset->insert($result[0][global_mapping::UserID]);
         if ($guid) {
             $userEmail = $result[0][global_mapping::Email];
             $fullName = $result[0][global_mapping::FullName];
             $linkReset = global_common::getHostName() . '/change_password.php?id=' . $guid;
             $arrMailContent = global_common::formatMailContent(global_common::TEMPLATE_RESET_PASSWORD, null, array(global_common::formatOutputText($result[0][global_mapping::FullName]), $linkReset, global_common::RESET_EXPIRE_DAYS));
             $emailSubject = $arrMailContent[0];
             $emailContent = $arrMailContent[1];
             $isSent = global_mail::send($userEmail, $fullName, $emailSubject, $emailContent, null, global_common::SUPPORT_MAIL_USERNAME, global_common::SUPPORT_MAIL_PASSWORD, global_common::SUPPORT_MAIL_DISPLAY_NAME);
             if ($isSent) {
                 $arrHeader = global_common::getMessageHeaderArr($banCode);
                 //$banCode
                 echo global_common::convertToXML($arrHeader, array('rs', 'inf'), array(1, 'Vui lòng kiểm tra email để cập nhật lại mật khẩu'), array(0, 1));
                 return;
             }
         }