Pergunta

I'm doing an app using Laravel, and I'm doing a login system. In login I don't have any problem, but in logout the browser gets an error

Whoops, looks like something went wrong.

My login function

public function postSignin() {
    if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')))) {
        return Redirect::to('users/dashboard')->with('message', 'You are now logged in!');
    } else {
        return Redirect::to('users/login')
            ->with('message', 'Your username/password combination was incorrect')
            ->withInput();
    }
}

My logout function

public function getLogout() {
    Auth::logout();
    return Redirect::to('users/login')->with('message', 'Your are now logged out!');
}

If I remove the line Auth::logout(); the page is redirected but I can't use the Auth::check() to verify the if the user is logged in.

After having the error Whoops, looks like something went wrong. if I refresh the page the redirect is done properly.

Any clue what the problem is?

Edited:

The error is just that

enter image description here

Foi útil?

Solução

If you are using Laravel version > 4.1.25 you may be missing the remember_token field on the users table.

see: http://laravel.com/docs/upgrade#upgrade-4.1.26

Laravel requires "nullable remember_token of VARCHAR(100), TEXT, or equivalent to your users table."

Outras dicas

i hope to be helpful giving you this link to a package with build-in authentication signup and admin panel with permission handling. Fully customizable: https://github.com/intrip/laravel-authentication-acl

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top