greggilbert / recaptcha

[ABANDONED] reCAPTCHA Validator for Laravel 5
MIT License
714 stars 197 forks source link

Multiple validations of the captcha rule #134

Open ghost opened 7 years ago

ghost commented 7 years ago

So, due to being very tired at one point I arrived at the following code in my project

if($validator->fails()) // check if password is correct and the captcha is filled in as well
{
    $this->increaseFaults($request); // increase the number of failed login attempts
}

$validator->validate(); // use validate to automatically deal with errors

Basically what I wanted to do was to show the captcha only after the user had multiple failed attempts at entering his password. What I didn't realize at that point was that the recaptcha validation rule wasn't 'pure' - and by this I mean that checking the captcha would work for the first check ( fails() ), but fail for the second one ( validate() ).

I suppose that this kind of double checking should never occur, but I guess the README should state this behavior somewhere.