私はphp artisan make:auth
を使用しました。ログインのためにメールアドレスをユーザ名に変更しています。 login.blade.phpで私はちょうどusernameをusernameに変更しました。ログイン後のリダイレクトは機能しませんが、登録後に正常に動作します
<div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
<label for="username" class="col-md-4 control-label">Username</label>
<div class="col-md-6">
<input id="username" type="name" class="form-control" name="username" value="{{ old('username') }}" required autofocus>
@if ($errors->has('username'))
<span class="help-block">
<strong>{{ $errors->first('username') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
さて、私は間違ってcredidentalsのエラーメッセージが出ていないし、正しいcredidentalsため/home
にリダイレクトされておりません、ログインページだけで再ロードします。 また、RegisterControllerの作成機能で'username' => $data['username'],
を追加しました。登録後には/ homeには正常にリダイレクトされますが、ログイン中にはリダイレクトされません。
私もlogincontrollerでこのプロパティをオーバーライドしています:Laravel 5.3でprotected $username = 'username';
をテンプレートに{{ますprint_r($エラー)}}任意のメッセージを取得していますか?電子メールフィールドの検証を試みている可能性がありますが、それは存在しないため、現在そのエラーは表示されません。 –
@JanWytze私は電子メールのエラーを受けましたが、このIlluminate \ Support \ ViewErrorBagオブジェクト([bags:protected] => Array([デフォルト] => Illuminate \ Support \ MessageBagオブジェクト([messages:protected )] [フォーマット:保護] =>:メッセージ))) – Steve