Skip to content

Commit

Permalink
Merge branch 'facebookSocialAuthFix' of github.com:thedevdojo/auth in…
Browse files Browse the repository at this point in the history
…to facebookSocialAuthFix
  • Loading branch information
tnylea committed Jun 30, 2024
2 parents 46d842e + 37ef78b commit b102cf3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Http/Controllers/SocialController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,14 @@ private function findOrCreateProviderUser($socialiteUser, $driver)
if ($user) {
$existingProvider = $user->socialProviders()->first();
if ($existingProvider) {
return redirect()->route('auth.login')->with('error',
return redirect()->route('auth.login')->with('error',
"This email is already associated with a {$existingProvider->provider_slug} account. Please login using that provider.");
}
}

return DB::transaction(function () use ($socialiteUser, $driver, $user) {
$user = $user ?? $this->createUser($socialiteUser);

return $this->createSocialProviderUser($user, $socialiteUser, $driver);
});
}
Expand Down

0 comments on commit b102cf3

Please sign in to comment.