From 788445e25e8aaf737102243390c3e1f8024a976c Mon Sep 17 00:00:00 2001 From: Linus Juhlin Date: Thu, 15 Aug 2019 17:47:39 +0200 Subject: [PATCH] Added guest middleware and changed redirect path --- app/Http/Middleware/RedirectIfAuthenticated.php | 2 +- routes/web.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index e4cec9c..e27860e 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -18,7 +18,7 @@ class RedirectIfAuthenticated public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { - return redirect('/home'); + return redirect('/'); } return $next($request); diff --git a/routes/web.php b/routes/web.php index eebfab0..e08d461 100644 --- a/routes/web.php +++ b/routes/web.php @@ -12,8 +12,8 @@ */ // Auth -Route::get('login')->name('login')->uses('Auth\LoginController@showLoginForm'); -Route::post('login')->name('login.attempt')->uses('Auth\LoginController@login'); +Route::get('login')->name('login')->uses('Auth\LoginController@showLoginForm')->middleware('guest'); +Route::post('login')->name('login.attempt')->uses('Auth\LoginController@login')->middleware('guest'); Route::post('logout')->name('logout')->uses('Auth\LoginController@logout'); // Dashboard