public validateCredentials ( Illuminate\Contracts\Auth\Authenticatable $user, array $credentials ) : boolean | ||
$user | Illuminate\Contracts\Auth\Authenticatable | |
$credentials | array | |
리턴 | boolean |
public function validateCredentials(Authenticatable $user, array $credentials)
{
if ($user instanceof CustomKeyAuthenticable) {
$method = 'get' . ucfirst($user->getAuthKeyName());
} else {
$method = 'getEmail';
}
return app('hash')->check($credentials['password'], $user->getAuthPassword()) && trim(strtolower($credentials['email'])) === trim(strtolower($user->{$method}()));
}