laravel / fortify

Backend controllers and scaffolding for Laravel authentication.
https://laravel.com/docs/fortify
MIT License
1.61k stars 295 forks source link

Call to undefined method Illuminate\Auth\DatabaseUserProvider::getModel() #268

Closed valtonia closed 3 years ago

valtonia commented 3 years ago

Description:

Laravel\Fortify\Actions\RedirectIfTwoFactorAuthenticatable calls a non-interface method ->getModel() on the user provider class obtained from the constructor argument $guard.

Illuminate\Contracts\Auth\UserProvider does not declare ->getModel() as a method but Illuminate\Auth\EloquentUserProvider implements it whereas Illumintate\Auth\DatabaseUserProvider does not.

Fortify should not call methods that are not part of the interface.

Steps To Reproduce:

Change the user provider setting in config/auth.php to use the "database" setting instead of "eloquent". Attempting to log in throws an error "Call to undefined method Illuminate\Auth\DatabaseUserProvider::getModel()"

valtonia commented 3 years ago

A temporary workaround for this issue is to disable two-factor auth in config/fortify.php

driesvints commented 3 years ago

Only Eloquent is supported atm.