0

I am a bit of a newbie to Laravel and I have setup a table User with fields username and password.

My sign in screen has a form with these fields duly declared and I have a function is UserController:

public function SignIn(Request $request)
{
    $this->validate($request,
        [
            'username' => 'required',
            'password' => 'required'
        ]);

    if (Auth::attempt([ 'username' => $request['username'], 'password' =>$request['password'] ]) )
    {
        return redirect()->route('dashboard');
    }
    else
    {
        return redirect()->back();
    }
}

I know it is getting there OK because I can see the error messages if I submit the form blank.

I have removed the default User Auth.

When I submit I get:

ErrorException in EloquentUserProvider.php line 114: Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\User given, called in /home/sites/mysticsisterfilms.com/public_html/admin/protected/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php on line 378 and defined

Can someone please point me in the right direction?

1
  • I realised that I had messed up an definition who I have amended it to class User extends Model implements Authenticatable. However even though the username and password are definitely correct it is not authenticating.
    – Jim
    May 23, 2016 at 3:22

1 Answer 1

0

A simple answer which I hope will be useful. In my database I had put the password in "as it were", ie mypassword.

Laravel assumes it is encrypted so of course it was always returning no match

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.