Bump users to the login page

Redirect users to the login page if they try to access a page
that requires their account.
This commit is contained in:
St John Karp 2018-08-12 07:40:07 -07:00
parent 87e1fbd3aa
commit b5f39c096a
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -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');