Ejemplo n.º 1
0
 /**
  * @inheritdoc
  * 
  * Takes the decision of rendering the widget or not depending on the number 
  * of requests made from the client IP.
  */
 public function run()
 {
     $captchaControl = new CaptchaControl(['model' => $this->model]);
     if ($captchaControl->hasReachedRequestNumber()) {
         parent::run();
     }
 }
 /**
  * @inheritdoc
  * 
  * Checks the CaptchaControl object in order to know if validation is needed 
  * or not.
  * Performs a hit in the captcha control cache component.
  */
 public function validateAttribute($model, $attribute)
 {
     $captchaControl = new CaptchaControl(['model' => $model]);
     if ($captchaControl->hasReachedRequestNumber()) {
         parent::validateAttribute($model, $attribute);
     }
     $captchaControl->hit();
 }