I have got problem with Laravel 5 mewebstudio/captcha.
I install it and on my page is captcha image
echo captcha_img()
echo Form::text('captcha','',["class"=>"form-control","placeholder"=>trans('page.captcha')]);
This works fine.
But the problem is with the validation, after the validation form I get a message about incorrect captcha.
My validation code:
if (Request::isMethod('post')){
//$data = Input::except(array('_token'));
$data = Input::all();
$rule = array(
'name' => 'required',
'firstname' => 'required',
'bdate' => 'required',
'email' => 'required|email',
'password' => 'required|min:6|same:password_repeat',
'password_repeat' => 'required|min:6',
'captcha' => 'required|captcha'
);
$validator = Validator::make($data, $rule);
if ($validator->fails()) {
$errors = $validator->messages();
}
}
I think captcha session is not working because after dump session I don't have captcha key which should be put in session (I found in Captcha.php )
$this->session->put('captcha', [
'sensitive' => $this->sensitive,
'key' => $this->hasher->make($this->sensitive ? $bag : $this->str->lower($bag))
]);
In Laravel 5.2 you need to change line 29 in CaptchaServiceProvider to
$this->app['router']->group(['middleware' => 'web'], function () {
$this->app['router']->get('captcha/{config?}', '\Mews\Captcha\CaptchaController@getCaptcha');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With