dqydp44800 2017-05-12 14:33
浏览 41
已采纳

提交表单时重定向到错误的路由

I am submitting my login form and define the route action="{{route('signin')}}" but it is redirecting the user to the login route.

form code is here .

<form  action="{{route('signin')}}" method="post" role="form">

                   <div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
                       <label>Enter Email : </label>

                           <input placeholder="Enter Email" name="email" type="text" class="form-control" value="{{Request::old('email')}}">
                           @if ($errors->has('email'))
                               <span class="help-block">
                                <strong>{{ $errors->first('email') }}</strong>
                            </span>
                           @endif

                    </div>


                    <div class="form-group {{ $errors->has('password') ? ' has-error' : '' }}">
                        <label>Enter  Password :</label>
                        <input placeholder="Enter Password" type="password" name="password" class="form-control" value="{{Request::old('password')}}">
                           @if ($errors->has('password'))
                               <span class="help-block">
                                <strong>{{ $errors->first('password') }}</strong>
                            </span>
                           @endif

                    </div>

                {{csrf_field()}}
                    <input class="btn btn-outline btn-danger" type="submit" value="submit" title="Login">


            </form>

Code in routes is here .

 Route::get('/login',[
    'uses' => 'userController@user',
    'as' => 'login'
]);
 Route::post('/signin',[
    'uses' => 'userController@postSignIn',
    'as' => 'signin',
    'middleware'=>'auth',
]);
  • 写回答

2条回答 默认 最新

  • dongmi4927 2017-05-12 14:54
    关注
    Route::post('/signin',[
        'uses' => 'userController@postSignIn',
        'as' => 'signin'
    ]);
    

    Just remove the "auth" middleware as it doesnt allow access to the method before sign in.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?