예제 #1
0
 protected function remindPassByEmail()
 {
     $messages = array();
     if ($this->hash() == $this->request('hash')) {
         if ($this->request('u_email') and php_mail_check($this->request('u_email'))) {
             $email = $this->request('u_email');
             $model = rad_instances::get('model_core_users');
             $model->setState('u_email', $email);
             $user = $model->getItem();
             if ($user and $user->u_active and $user->u_email_confirmed) {
                 if (!($error = $this->beforeRemindPassword($user))) {
                     $this->remindPassword($user);
                 } else {
                     $messages[] = $error;
                 }
             } else {
                 $messages[] = $this->lang('notfoundemail.session.error');
             }
         } else {
             $messages[] = $this->lang('entervalidemail.session.error');
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
     if (count($messages)) {
         $this->setVar('message', implode('<br />', $messages));
     } else {
         $this->setVar('code_sent', true);
     }
 }
예제 #2
0
 /**
  * Проверка полей
  */
 function validator()
 {
     $rs = false;
     if ($this->request('sender_email') and $this->request('sender_fio') and $this->request('message_body')) {
         $modelCaptcha = new model_coresession_captcha(SITE_ALIAS);
         if (!php_mail_check($this->request('sender_email'))) {
             $this->setVar('error_message', $this->lang('entervalidemail.feedback.error', null, true));
             $rs = false;
         } elseif (mb_strlen($this->request('message_body')) < 3) {
             $this->setVar('error_message', $this->lang('entercorrectbody.feedback.error', null, true));
             $rs = false;
         } elseif (!$modelCaptcha->check($this->request('captcha_text'))) {
             $this->setVar('error_message', $this->lang('wrongcaptcha.session.error', null, true));
             $rs = false;
         } else {
             $rs = true;
         }
     } elseif ($this->request('phone') and $this->request('sender_fio') and $this->request('captcha_text')) {
         $modelCaptcha = new model_coresession_captcha('index.html');
         $jsonResult = array();
         if (mb_strlen($this->request('sender_fio')) < 3) {
             $jsonResult['error_message'] = $this->lang('entercorrectfio.feedback.error', null, true);
             $this->setVar('error_message', json_encode($jsonResult));
             $rs = false;
         } elseif (!preg_match('/^[+]7[(]\\d{3}[)]\\d{3}-\\d{2}-\\d{2}$/', $this->request('phone'))) {
             $jsonResult['error_message'] = $this->lang('entercorrectphone.callback.error');
             $this->setVar('error_message', json_encode($jsonResult));
             $rs = false;
         } elseif (!$modelCaptcha->check($this->request('captcha_text'))) {
             $jsonResult['error_message'] = $this->lang('wrongcaptcha.session.error', null, true);
             $this->setVar('error_message', json_encode($jsonResult));
             $rs = false;
         } else {
             $rs = true;
             $res = array();
             $res['error_message'] = 'error_none';
             $this->setVar('error_message', json_encode($res));
         }
     } else {
         $jsonResult['error_message'] = "error_occurred";
         $this->setVar('error_message', json_encode($jsonResult));
         $rs = false;
     }
     return $rs;
 }