commit b5f39c096a1186308260cef1d3340c1ac90cb9ea
parent 87e1fbd3aa9119245378a803e69bd52f7e965fc1
Author: St John Karp <stjohn@fuzzjunket.com>
Date: Sun, 12 Aug 2018 07:40:07 -0700
Bump users to the login page
Redirect users to the login page if they try to access a page
that requires their account.
Diffstat:
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/app/Http/Controllers/TimelineController.php b/app/Http/Controllers/TimelineController.php
@@ -17,6 +17,11 @@ class TimelineController extends Controller
public function home_timeline()
{
+ if (!session()->has('user'))
+ {
+ return redirect()->route('login');
+ }
+
$user = session('user');
$timeline = Mastodon::domain(env('MASTODON_DOMAIN'))
->token($user->token)
diff --git a/routes/web.php b/routes/web.php
@@ -21,6 +21,7 @@ Route::get('/timeline/public', 'TimelineController@public_timeline')
Route::get('/timeline/friends', 'TimelineController@home_timeline')
->name('friends');
-Route::get('/login', 'LoginController@login');
+Route::get('/login', 'LoginController@login')
+ ->name('login');
Route::get('/callback', 'LoginController@callback');