Support the ongoing development of Laravel.io →
Authentication Security Views

Having trouble displaying my dashboard after signing in. Here is my UsersController, users/dashboard, filters and route files receptively:

UsersController:

	public function postLogin() {
		if(Auth::check()){
			return 'Tisk tisk already logged in';
		}
		if(Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), Input::get('remember-me')))
		{
			return Redirect::intended('/')
			->with('message', 'You are now logged in!');
		}
		return Redirect::to('/users/login')
			->with('message', 'Your username/password combination was incorrect')
			->withInput();
	}

filters:

Route::filter('auth', function()
{
	if (!Auth::check());
	{
		if (Request::ajax())
		{
			return Response::make('Unauthorized', 401);
		}
		else
		{
			return Redirect::guest('users/login');
		}
	}
});


Route::filter('auth.basic', function()
{
	return Auth::basic();
});

routes:

Route::get('/', array('before'=>'auth',function(){
	return View::make('users.dashboard');
}));

Route::controller('users', 'UsersController');

dashboard:

@extends('layouts.main')

@section('content')
<h1>LASA Dashboard</h1>

<p>Welcome to your Dashboard. You are awesomesauce!</p>
@stop

Am I setting up my route wrong? Every-time I try signing in it leads me back to the sign in page. Any advice would be helpful!

Thanks in advance

Last updated 3 years ago.
0

I'm so dumb... I knew it was a routing error. I changed the 'before' to 'after' in my routes file.

Route::get('/', array('after'=>'auth',function(){
    return View::make('users.dashboard');
}));

Route::controller('users', 'UsersController');
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.