Merge pull request #649 from Robbt/remove-recaptcha

removed the recaptcha
This commit is contained in:
Lucas Bickel 2018-12-18 19:10:14 +01:00 committed by GitHub
commit cb0daddaf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 34 deletions

View file

@ -58,11 +58,7 @@ class LoginController extends Zend_Controller_Action
//Open the session for writing, because we close it for writing by default in Bootstrap.php as an optimization. //Open the session for writing, because we close it for writing by default in Bootstrap.php as an optimization.
//session_start(); //session_start();
// if the post contains recaptcha field, which means form had recaptcha field.
// Hence add the element for validation.
if (array_key_exists('recaptcha_response_field', $request->getPost())) {
$form->addRecaptcha();
}
if ($form->isValid($request->getPost())) { if ($form->isValid($request->getPost())) {
//get the username and password from the form //get the username and password from the form
$username = $form->getValue('username'); $username = $form->getValue('username');
@ -276,10 +272,6 @@ class LoginController extends Zend_Controller_Action
Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']); Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']);
$form = new Application_Form_Login(); $form = new Application_Form_Login();
$this->view->error = true; $this->view->error = true;
//Only show the captcha if you get your login wrong 4 times in a row.
if (Application_Model_Subjects::getLoginAttempts($username) > 3) {
$form->addRecaptcha();
}
return $form; return $form;
} }
} }

View file

@ -71,10 +71,6 @@ class Application_Form_Login extends Zend_Form
"locale" => Application_Model_Locale::getUserLocale() "locale" => Application_Model_Locale::getUserLocale()
)); ));
if (Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3) {
$this->addRecaptcha();
}
// Add the submit button // Add the submit button
$this->addElement('submit', 'submit', array( $this->addElement('submit', 'submit', array(
'ignore' => true, 'ignore' => true,
@ -87,26 +83,6 @@ class Application_Form_Login extends Zend_Form
} }
public function addRecaptcha()
{
$pubKey = '6Ld4JsISAAAAAIxUKT4IjjOGi3DHqdoH2zk6WkYG';
$privKey = '6Ld4JsISAAAAAJynYlXdrE4hfTReTSxYFe5szdyv';
$params= array('ssl' => true);
$recaptcha = new Zend_Service_ReCaptcha($pubKey, $privKey, $params);
$captcha = new Zend_Form_Element_Captcha('captcha',
array(
'label' => _('Type the characters you see in the picture below.'),
'captcha' => 'ReCaptcha',
'captchaOptions' => array(
'captcha' => 'ReCaptcha',
'service' => $recaptcha
)
)
);
$this->addElement($captcha);
}
/** /**
* tests if a string starts with a given string * tests if a string starts with a given string

View file

@ -30,7 +30,6 @@
<?php echo $this->element->getElement('csrf') ?> <?php echo $this->element->getElement('csrf') ?>
<?php echo $this->element->getElement('captcha') ?>
<dt id="submit-label">&nbsp;</dt> <dt id="submit-label">&nbsp;</dt>
<dd id="submit-element"> <dd id="submit-element">
<?php echo $this->element->getElement('submit') ?> <?php echo $this->element->getElement('submit') ?>