php - How to stop bootstrap modal from closing after authentication fail in laravel 5.1? -
i have bootstrap modal login when ever fails redirects auth/login , modal closes. how stop modal closing when authentication fails , how stop redirecting auth/login?
my login form:
<form action="{{ url::to('auth/login')}}" method="post"> {!! csrf_field() !!} <div class="left-form__form"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <input class="mdl-textfield__input" type="text" id="mdl_email" name="email"> <label class="mdl-textfield__label" for="mdl_email">email id</label> </div> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <input class="mdl-textfield__input" type="password" id="mdl_password" name="password"> <label class="mdl-textfield__label" for="mdl_password">password</label> </div> <div class="left-form__form--bottom"> <button type="submit" class="btn-style1 mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent"> login </button> <a href="javascript:void(0);" class="fgt-pwd">forgot password?</a> </div> <a href="#" class="register-link">new srsgrocery? <span>signup</span></a> </div> </form>
the modal :
@if(auth::guest()) <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 top-right"> <span class="call-icon"></span> <span class="call-text">call order: 1800-419-2777</span> <a href="" title="" class="login" data-toggle="modal" data-target="#loginregistermodal">login |</a> <a href="" title="" class="register" data-toggle="modal" data-target="#loginregistermodal">register</a> </div> @else <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 top-right"> <span class="call-icon"></span> <span class="call-text">call order: 1800-419-2777</span> <a href="{{url::to('myaccount')}}">my account </a> <a href="{{url::to('auth/logout')}}">logout</a> </div> @endif
try : login modal :
<div id="loginregistermodal" class="modal fade" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">login : </h4> </div> <div class="modal-body"> <!-- login form inside modal --> ... <div class="modal-footer"> <button type="cancel" class="btn btn-danger" data-dismiss="modal">close</button> </div> </div> </div> </div> </div>
in authcontroller :
... public function postlogin(request $request) { $data = $request->all(); $v = validator::make($data, $this->rules); if ($v->fails()) { return response::json(array( 'success' => false, 'errors' => $v->errors(), 'status' => 422 )); } if (auth::attempt($credentials, $request->has('remember'))) { return redirect()->intended($this->redirectpath()) ->with('success', 'you logged in'); } return response::json(array( 'password' => 'password invalid', 'email' => 'email invalid' )); } protected $rules = array( 'email' => 'required', 'password' => 'required|min:6', );
hope helps :)
Comments
Post a Comment