I followed this tutorial on creating a registration and login page using Laravel.
Everything works smoothly, the only issue is that I am unable to Login. If I provide the wrong username/password, it correctly gives me an error message. But if I use the right credentials, I get the following error -
Illuminate \ Session \ TokenMismatchException
This is my (default) csrf function -
Route::filter('csrf', function()
{
if (Session::token() != Input::get('_token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
});
This is the form action -
{{ Form::open(array('url'=>'signin', 'class'=>'form-signin')) }}
And this is the relevant portion of my UsersController
public function __construct() {
$this->beforeFilter('csrf', array('on'=>'post'));
$this->beforeFilter('auth', array('only'=>array('getDashboard')));
}
public function postSignin() {
if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')))) {
return Redirect::to('dashboard')->with('message', 'You are now logged in!');
} else {
return Redirect::to('login')
->with('message', 'Your username/password combination was incorrect')
->withInput();
}
}
public function getDashboard() {
$this->layout->content = View::make('users.dashboard');
}