mercredi 28 octobre 2015

laravel 5.1 login not working

I used laravel 5.1 authentication for login . but Auth::attempt($credentials) returns false always!

I used the following route to create user:

Route::get('newuser', function () {
  return User::create([
    'username' => 'admin',
    'email' => 'admin@gmail.com',
    'password' => Hash:make('123'),
  ]);
});

I added a simple postLogin function to override this function in AuthController:

public function postLogin(Request $request) {
    $credentials = $this->getCredentials($request);
    if(Auth::attempt($credentials)) {
        return 'ok';
    }
    return 'nok';
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire