3
我正在創建一個頁面,它在一個頁面中同時註冊和登錄。
我的代碼看起來像這樣在laravel的一個頁面中註冊並登錄表單5.3
<div class="w3-display-container w3-white">
<div style="white-space:nowrap;" class="container">
<h2>Already have an account?</h2><hr>
<div class="col-md-8 col-md-offset-2 w3-margin-bottom">
{!! Form::open(['route' => 'login', 'method' => 'POST']) !!}
<div class="form-group {{ $errors->has('email') ? 'has-error has-feedback' : '' }}">
{{ Form::label('email', 'Enter Your Email...', ['class' => 'control-label']) }}
{{ Form::email('email', null, ['class' => 'form-control', 'placeholder' => 'email...', 'value' => old('email')]) }}
<span class="{{ $errors->has('email') ? 'glyphicon glyphicon-remove form-control-feedback' : '' }}"></span>
</div>
<div class="form-group {{ $errors->has('password') ? 'has-error has-feedback' : '' }}">
{{ Form::label('password', 'Enter Your Password...', ['class' => 'control-label']) }}
{{ Form::password('password', ['class' => 'form-control', 'placeholder' => 'password...']) }}
<span class="{{ $errors->has('password') ? 'glyphicon glyphicon-remove form-control-feedback' : '' }}"></span>
</div>
{{ Form::submit('Log in', ['class' => 'btn btn-success w3-margin-top']) }}
{!! Form::close() !!}
</div>
</div>
</div>
<div class="w3-display-container w3-white">
<div style="white-space:nowrap;" class="container">
<h2>New Here?</h2><hr>
<div class="col-md-8 col-md-offset-2 w3-margin-bottom">
{!! Form::open(['route' => 'register']) !!}
<div class="form-group {{ $errors->has('name') ? 'has-error has-feedback' : '' }}">
{{ Form::label('name', 'Username...', ['class' => 'control-label']) }}
{{ Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'username...']) }}
<span class="{{ $errors->has('name') ? 'glyphicon glyphicon-remove form-control-feedback' : '' }}"></span>
</div>
<div class="form-group {{ $errors->has('email') ? 'has-error has-feedback' : '' }}">
{{ Form::label('email', 'Email...', ['class' => 'control-label']) }}
{{ Form::email('email', null, ['class' => 'form-control', 'placeholder' => 'email...']) }}
<span class="{{ $errors->has('email') ? 'glyphicon glyphicon-remove form-control-feedback' : '' }}"></span>
</div>
<div class="form-group {{ $errors->has('password') ? 'has-error has-feedback' : '' }}">
{{ Form::label('password', 'Password...', ['class' => 'control-label']) }}
{{ Form::password('password', ['class' => 'form-control', 'placeholder' => 'passsword...']) }}
<span class="{{ $errors->has('password') ? 'glyphicon glyphicon-remove form-control-feedback' : '' }}"></span>
</div>
<div class="form-group {{ $errors->has('password') ? 'has-error has-feedback' : '' }}">
{{ Form::label('password_confirmation', 'Confirm Password...', ['class' => 'control-label']) }}
{{ Form::password('password_confirmation', ['class' => 'form-control', 'placeholder' => 'confirm password...']) }}
<span class="{{ $errors->has('password') ? 'glyphicon glyphicon-remove form-control-feedback' : '' }}"></span>
</div>
{{ Form::submit('Sign Up', ['class' => 'btn btn-success w3-margin-top']) }}
{!! Form::close() !!}
</div>
</div>
</div>
我用引導和W3Schools的造型爲。
我得到的問題是,當我提交任何一個形式的空輸入它給我錯誤的兩種形式。
這是(例如),當我提交帶有空電子郵件和密碼字段的登錄表單時,錯誤顯示在登錄表單和註冊表格中,該字段爲空。
我該如何解決? 我想顯示不同的錯誤。
對我的代碼還是有疑問的,或者我的問題請在下面留言。
我甚至看了this尋求幫助,但它是laravel 5.2,laravel 5.3有不同的身份驗證路徑系統
莫非你告訴具體的案件和輸入值,你在兩種形式中都會遇到錯誤。 –