2017-10-13 16 views
1

にリダイレクトされました。私はLaravel 5.3(5.2から)にアップグレードしたばかりで、今は認証ルートに問題があります。Laravel 5.3の認証ルートは/

RegisterControllerに必要なメトンを実装し、Auth::routes();routes/web.phpに追加しました。しかし私がアクセス/登録すると、私はいつも/にリダイレクトされます。

どうして私は何が間違っているのか分かりません。

ミドルウェア:

protected $middlewareGroups = [ 
     'web' => [ 
      \App\Http\Middleware\EncryptCookies::class, 
      \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 
      \Illuminate\Session\Middleware\StartSession::class, 
      \Illuminate\View\Middleware\ShareErrorsFromSession::class, 
      \Illuminate\Routing\Middleware\SubstituteBindings::class, 
      \App\Http\Middleware\VerifyCsrfToken::class, 
     ], 
     'api' => [ 
      'throttle:60,1', 
      'bindings', 
     ], 
    ]; 

アップデート:私は理由を見つけた:私はすでにで調印された、したがって、それは常に私を転送。私がまだ分かっていないことは、それがそうしているか?

+0

あなたはHTTPカーネルの 'middlewareGroups'プロパティを追加することはできますか? – Maraboc

+0

ちょうどそれをしました。ありがとうございました – Michael

答えて

0

Auth :: routes()は、ユーザー認証に必要なすべてのルートを生成するのに役立つヘルパークラスです。コードを変更するには、以下のリンク閲覧することができます:

// Authentication Routes... 
$this->get('login', 'Auth\[email protected]')->name('login'); 
$this->post('login', 'Auth\[email protected]'); 
$this->post('logout', 'Auth\[email protected]')->name('logout'); 

// Registration Routes... 
$this->get('register', 'Auth\[email protected]')->name('register'); 
$this->post('register', 'Auth\[email protected]'); 

// Password Reset Routes... 
$this->get('password/reset', 'Auth\[email protected]'); 
$this->post('password/email', 'Auth\[email protected]'); 
$this->get('password/reset/{token}', 'Auth\[email protected]'); 
$this->post('password/reset', 'Auth\[email protected]'); 

はおそらく、パスを変更するには、この機能$this->get('register', 'Auth\[email protected]')->name('register');をチェックするために持っているか、それはあなたのミドルウェアとは何かを持っています。

+0

答えをありがとう、私はそれを認識しています。コントローラーが正しく設定されています。ミドルウェアはデフォルトのものです(更新された質問を参照)。 – Michael

+0

申し訳ありません、問題ありません。私がまだ考えることができるのは、Webミドルウェア間のルートを設定することだけです。何があなたの問題を引き起こしているのか分かりません。 –

+0

私は原因を見つけましたが、それを修正する方法はありませんでした。更新された質問をご覧ください。 – Michael

2

原因を突き止めました。

それはRedirectIfAuthenticatedミドルウェアである:

if (Auth::guard($guard)->check()) { 
    return redirect('/'); 
} 
関連する問題