public function renderLoginPage()
 {
     $showRecaptcha = Am_Recaptcha::isConfigured() && $this->authResult && $this->authResult->getCode() == Am_Auth_Result::FAILURE_ATTEMPTS_VIOLATION;
     if ($showRecaptcha) {
         $recaptcha = $this->getDi()->recaptcha;
     }
     if ($this->isAjax()) {
         $ret = array('ok' => false, 'error' => @$this->view->error, 'code' => $this->authResult ? $this->authResult->getCode() : null);
         if ($showRecaptcha) {
             $ret['recaptcha_key'] = $recaptcha->getPublicKey();
             $ret['recaptcha_error'] = $recaptcha->getError();
         }
         return $this->ajaxResponse($ret);
     }
     $loginUrl = $this->findLoginUrl();
     if ($showRecaptcha) {
         $this->view->recaptcha = $recaptcha->render();
     }
     $this->view->assign('form_action', $loginUrl);
     $this->view->assign('this_config', $this->getDi()->config->get($this->configBase));
     $this->view->display('login.phtml');
 }
Example #2
0
 public static function createAvailableBricks($className)
 {
     return Am_Recaptcha::isConfigured() ? parent::createAvailableBricks($className) : array();
 }