Fix silly CAPTCHA flow, now only asks if you get your password wrong 4
times in a row
This commit is contained in:
parent
2cc7557cb7
commit
f157cad877
1 changed files with 38 additions and 36 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue