Phosphorum\Controllers\ControllerBase::checkCaptcha PHP Method

checkCaptcha() protected method

Validation Google captcha
protected checkCaptcha ( ) : boolean
return boolean
    protected function checkCaptcha()
    {
        if (!$this->recaptcha->isEnabled()) {
            return true;
        }
        if ($this->isUserTrust()) {
            return true;
        }
        if ($this->request->hasPost('g-recaptcha-response')) {
            $this->flashSession->error('Please confirm that you are not a bot.');
            return false;
        }
        $captcha = $this->recaptcha->getCaptcha();
        $resp = $captcha->verify($this->request->getPost('g-recaptcha-response'), $this->request->getClientAddress());
        if (!$resp->isSuccess()) {
            $this->flashSession->error('Please confirm that you are not a bot.');
            return false;
        }
        return true;
    }