removed the recaptcha
This commit is contained in:
parent
784bac256e
commit
2c3db00f12
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue