コード例 #1
0
 /**
  * Compare submitted captch string
  * to actual captcha string
  *
  */
 protected function validateCaptcha()
 {
     $Captcha = Captcha::factory($this->Registry->Ini);
     $res = $Captcha->validate_submit();
     /**
      * If validation good then
      * all is OK
      */
     if (1 === $res) {
         return $this;
     }
     /**
      * If 3 then reached the limit of attampts
      */
     if (3 === $res) {
         throw new \Lampcms\CaptchaLimitException('You have reached the limit of image verification attempts');
     }
     /**
      * @todo translate string
      */
     $this->setFormError(self::CAPTCHA_ERROR);
     return $this;
 }
コード例 #2
0
 /**
  *
  */
 protected function validateCaptcha()
 {
     if (!empty($_SESSION['reg_captcha'])) {
         return $this;
     }
     $oCaptcha = Captcha::factory($this->Registry->Ini);
     $res = $oCaptcha->validate_submit();
     /**
      * If validation good then
      * all is OK
      */
     if (1 === $res) {
         $_SESSION['reg_captcha'] = true;
         return $this;
     }
     /**
      * If 3 then reached the limit of attempts
      */
     if (3 === $res) {
         throw new \Lampcms\CaptchaLimitException('@@You have reached the limit of image verification attempts@@');
     }
     $aRet = array('exception' => '@@Incorrect image verification text@@<br/>@@Please try again@@', 'fields' => array('private_key'), 'captcha' => $oCaptcha->getCaptchaArray());
     Responder::sendJSON($aRet);
 }
コード例 #3
0
 protected function main()
 {
     $this->aPageVars['title'] = $this->_('Create New Account');
     /**
      * Don't bother with token
      * for this form.
      * It uses captcha, so allow
      * users to submit without token
      */
     $this->Form = new \Lampcms\Forms\Regform($this->Registry, false);
     $this->Form->setVar('action', 'register');
     /**
      * Set divID to registration because otherwise
      * it is default to 'regform' which causes
      * the whole form's div to be turned into
      * a modal which is used in quickReg or Join controllers
      * but for this controller we want a regular web page,
      * no modals, no Ajax
      *
      * Also set className to 'registration' because it defaults
      * to yui-pre-content which makes the whole div hidden
      * This is a trick for adding something that later is turned
      * into modal, but we don't need it for this page
      */
     $this->Form->setVar('divID', 'registration');
     $this->Form->setVar('className', 'registration');
     $this->Form->setVar('header2', $this->_('Create New Account'));
     $this->Form->setVar('button', '<input name="submit" value="' . $this->_('Register') . '" type="submit" class="btn btn-m">');
     $this->Form->setVar('captcha', Captcha::factory($this->Registry->Ini)->getCaptchaBlock());
     $this->Form->setVar('title', $this->_('Create an Account'));
     $this->Form->setVar('titleBar', '');
     if ($this->Form->isSubmitted() && $this->Form->validate()) {
         $this->getSubmittedValues()->createNewUser()->createEmailRecord()->sendActivationEmail();
         /**
          * @todo Translate string
          */
         $this->aPageVars['body'] = '<div id="tools" class="larger">' . self::SUCCESS . '</div>';
     } else {
         $this->aPageVars['body'] = '<div id="userForm" class="frm1">' . $this->Form->getForm() . '</div>';
     }
 }
コード例 #4
0
 /**
  * Makes html for the captcha block, complete
  * with image, input element for captcha
  * and 2 hidden fields
  *
  * @return string HTML block
  */
 protected function makeCaptchaBlock()
 {
     $s = Captcha\Captcha::factory($this->Registry->Ini)->getCaptchaBlock();
     return $s;
 }
コード例 #5
0
ファイル: Regform.php プロジェクト: codigoirreverente/LampCMS
 /**
  *
  */
 protected function validateCaptcha()
 {
     if (!empty($_SESSION['reg_captcha'])) {
         return $this;
     }
     $oCaptcha = Captcha::factory($this->Registry->Ini);
     $res = $oCaptcha->validate_submit();
     /**
      * If validation good then
      * all is OK
      */
     if (1 === $res) {
         $_SESSION['reg_captcha'] = true;
         return $this;
     }
     /**
      * If 3 then reached the limit of attampts
      */
     if (3 === $res) {
         throw new \Lampcms\CaptchaLimitException('You have reached the limit of image verification attempts');
     }
     if (Request::isAjax()) {
         $aRet = array('exception' => self::CAPTCHA_ERROR, 'fields' => array('private_key'), 'captcha' => $oCaptcha->getCaptchaArray());
         \Lampcms\Responder::sendJSON($aRet);
     }
     /**
      * @todo translate string
      */
     $this->setFormError(self::CAPTCHA_ERROR);
     return $this;
 }
コード例 #6
0
ファイル: Editapp.php プロジェクト: netconstructor/LampCMS
 /**
  * Populate form values with
  * existing data from oApi object
  * if this is a new registration then
  * $this->oApi has empty array as its data
  * and all values will be empty (just as we expect)
  *
  * @return object $this
  */
 protected function setForm()
 {
     $c = Captcha::factory($this->Registry->Ini)->getCaptchaBlock();
     $id = $this->Request->get('app_id', 'i', 0);
     $this->Form->formTitle = $this->aPageVars['title'] = empty($id) ? 'Register an Application' : 'Edit Application details';
     $this->Form->setVar('captcha', $c);
     $this->Form->app_id = (int) $this->oApi['_id'];
     $this->Form->app_name = $this->oApi['app_name'];
     $this->Form->appsite = $this->oApi['appsite'];
     $this->Form->company = $this->oApi['company'];
     $this->Form->company = $this->oApi['company'];
     $this->Form->app_type = $this->oApi['app_type'];
     $this->Form->about = $this->oApi['about'];
     $this->Form->icon_image = $this->oApi->getIcon(false);
     return $this;
 }