Fix silly CAPTCHA flow, now only asks if you get your password wrong 4

times in a row
This commit is contained in:
Albert Santoni 2014-09-03 11:43:06 -04:00
parent 2cc7557cb7
commit f157cad877

View file

@ -52,9 +52,7 @@ class LoginController extends Zend_Controller_Action
$username = $form->getValue('username');
$password = $form->getValue('password');
$locale = $form->getValue('locale');
if (Application_Model_Subjects::getLoginAttempts($username) >= 3 && $form->getElement('captcha') == NULL) {
$form->addRecaptcha();
} else {
$authAdapter = Application_Model_Auth::getAuthAdapter();
//pass to the adapter the submitted username and password
@ -94,6 +92,10 @@ class LoginController extends Zend_Controller_Action
Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']);
$form = new Application_Form_Login();
$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();
}
}
}