Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Retrieve user through provider #189

Merged
merged 1 commit into from
Jan 4, 2021
Merged

Conversation

driesvints
Copy link
Member

Re-send for #180

@taylorotwell taylorotwell merged commit f0f8080 into 1.x Jan 4, 2021
@taylorotwell taylorotwell deleted the update-user-provider branch January 4, 2021 14:48
taylorotwell added a commit that referenced this pull request Jan 7, 2021
taylorotwell added a commit that referenced this pull request Jan 7, 2021
Comment on lines +78 to +88
$user = $this->guard->getProvider()->retrieveByCredentials(
$request->only(Fortify::username(), 'password')
);

return tap($model::where(Fortify::username(), $request->{Fortify::username()})->first(), function ($user) use ($request) {
if (! $user || ! Hash::check($request->password, $user->password)) {
$this->fireFailedEvent($request, $user);
if (! $user) {
$this->fireFailedEvent($request, $user);

$this->throwFailedAuthenticationException($request);
}
});
$this->throwFailedAuthenticationException($request);
}

return $user;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The verification might be not enough. retrieveByCredentials() does not expect password matches, only an email address does. Password hash validation is done by validateCredentials(), but its call was not included in the PR.

I think it is the cause of the PR reverted.

@taylorotwell Is it right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants