Ejemplo n.º 1
0
 /**
  * Forgery constructor
  *
  * @param string $renderUrl
  */
 public function __forge($renderUrl = null)
 {
     $this->captcha = \Magelight\Webform\Models\Captcha\Captcha::forge();
     if (empty($renderUrl)) {
         $this->captcha->loadCodeFromSession()->generate()->saveCodeToSession();
         $this->captcha->save();
     }
     $this->set('image_url', !empty($renderUrl) ? $renderUrl : $this->url($this->captcha->getSavedFileName()));
     $this->addClass('form-group');
 }
Ejemplo n.º 2
0
 /**
  * Check value with rule
  * Returns:
  *    - true if rule passed.
  *    - false if value doesn`t match the rule.
  *
  * @param mixed $value
  * @return bool
  */
 public function check($value)
 {
     return \Magelight\Webform\Models\Captcha\Captcha::forge()->check($value);
 }
Ejemplo n.º 3
0
 /**
  * Render captcha image action
  */
 public function render_captchaAction()
 {
     \Magelight\Webform\Models\Captcha\Captcha::forge()->generate()->saveCodeToSession()->render();
 }