mercredi 13 janvier 2016

Laravel 5 mewebstudio/captcha not working

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 is problem with validation, After validation form i have message about inncorect captcha

My valid 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 not working becouse after dump session i dont 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))
    ]);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire