Twitter引导程序登录表单始终使用Laravel 5.2 scaffolded auth提供验证错误

时间:2016-05-16 11:38:12

标签: twitter-bootstrap laravel authentication

我使用简单的make:auth脚手架登录我的应用程序。它工作正常,直到我应用了一些Bootstrap样式。现在,每当我尝试提交表单时,它总是会出现“需要用户名字段”的错误,“需要密码字段”

这是login.blade.php:

<div class="panel-body">
            <form class="no-margin" role="form" method="POST" action="{{ url('/login') }}">
                {!! csrf_field() !!}

                    <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                        <label for="email" >Email</label>
                        <div class="input-group">
                            <span class="input-group-addon">
                                <i class="fa fa-user"></i>
                            </span>
                            <input id="email" type="email" class="form-control input-lg input-transparent"
                                   value="{{ old('email') }}" placeholder="Your Email">
                            @if ($errors->has('email'))
                                <span class="help-block">
                                <strong>{{ $errors->first('email') }}</strong>
                            </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}" >
                        <label for="password" >Password</label>

                        <div class="input-group input-group-lg">
                            <span class="input-group-addon">
                                <i class="fa fa-lock"></i>
                            </span>
                            <input id="password" type="password" class="form-control input-lg input-transparent"
                                   placeholder="Your Password">

                            @if ($errors->has('password'))
                                <span class="help-block">
                                <strong>{{ $errors->first('password') }}</strong>
                            </span>
                            @endif
                        </div>
                    </div>


                <div class="form-actions">
                    <button type="submit" class="btn btn-block btn-lg btn-danger">
                        <span class="small-circle"><i class="fa fa-caret-right"></i></span>
                        <small>Sign In</small>
                    </button>
                    <a class="forgot" href="{{ url('/password/reset') }}">Forgot Username or Password?</a>
                </div>
            </form>
        </div>

1 个答案:

答案 0 :(得分:3)

您忘记将字段name添加到电子邮件输入和密码输入中,这就是为什么您的laravel无法访问这些输入的值并触发异常