recaptcha icon indicating copy to clipboard operation
recaptcha copied to clipboard

Validation message is not shown

Open danifantom opened this issue 8 years ago • 2 comments

If I try to send the form without completing the captcha the form just reloads with no error messages. In the LoginController.php I have this

 protected function validateLogin(Request $request)
    {
        $this->validate($request, [
            $this->username() => 'required', 
            'password' => 'required',
            'g-recaptcha-response' => 'required|recaptcha',
        ]);
    }

I've even tried to change the validation message but nothing shows up

danifantom avatar Jun 20 '17 18:06 danifantom

Add this code to your view

@if(count($errors->all()) > 0)
  <div class="alert alert-danger" role="alert"> <p><b>Attenzione!</b></p>
    <ul>
      @foreach($errors->all() as $error)
        <li>{{ $error }}</li>
      @endforeach
    </ul>
  </div>
@endif

Askancy avatar Jul 04 '17 10:07 Askancy

I used this

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">{!! Recaptcha::render() !!}
                             @if ($errors->has('g-recaptcha-response'))
                                 <span class="help-block">
                                     <strong>{{ $errors->first('g-recaptcha-response') }}</strong>
                                 </span>
                             @endif
                            </div>
                        </div>

ihsanberahim avatar Jul 19 '17 01:07 ihsanberahim