Updated social login to redirect to intended page.

Closes #508.
This commit is contained in:
Dan Brown 2017-09-14 20:20:47 +01:00
parent cd7e727f8c
commit 39e7ac1c15
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
1 changed files with 2 additions and 8 deletions

View File

@ -104,7 +104,8 @@ class SocialAuthService
// When a user is not logged in and a matching SocialAccount exists, // When a user is not logged in and a matching SocialAccount exists,
// Simply log the user into the application. // Simply log the user into the application.
if (!$isLoggedIn && $socialAccount !== null) { if (!$isLoggedIn && $socialAccount !== null) {
return $this->logUserIn($socialAccount->user); auth()->login($socialAccount->user);
return redirect()->intended('/');
} }
// When a user is logged in but the social account does not exist, // When a user is logged in but the social account does not exist,
@ -137,13 +138,6 @@ class SocialAuthService
throw new SocialSignInException($message . '.', '/login'); throw new SocialSignInException($message . '.', '/login');
} }
private function logUserIn($user)
{
auth()->login($user);
return redirect('/');
}
/** /**
* Ensure the social driver is correct and supported. * Ensure the social driver is correct and supported.
* *