First of all thank you for this great and easy to use captcha package.
VERSION
PHP version 7.1.22
Laravel version 5.4
Package version 2.1.0
ISSUE
Captcha validation fails when using $validator->passes() or $validator->fails() inside a FormRequest class. I have a request validation class which always throws the 'Invalid code from the image' error
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class MyRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'captcha' => 'required|captcha',
];
}
public function withValidator($validator)
{
if($validator->passes())
{
//do something
}
}
}
LIKELY CAUSE
Running $validator->passes() or $validator->fails() runs the validation again, but the captcha session is likely cleared in the first validation which causes the validation to fail when run for the second time.
First of all thank you for this great and easy to use captcha package.
VERSION PHP version 7.1.22 Laravel version 5.4 Package version 2.1.0
ISSUE Captcha validation fails when using $validator->passes() or $validator->fails() inside a FormRequest class. I have a request validation class which always throws the 'Invalid code from the image' error
LIKELY CAUSE Running $validator->passes() or $validator->fails() runs the validation again, but the captcha session is likely cleared in the first validation which causes the validation to fail when run for the second time.