X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c429cf78187e80deb63982a282a1c6889f30291a..refs/pull/2902/head:/app/Auth/Access/SocialAuthService.php diff --git a/app/Auth/Access/SocialAuthService.php b/app/Auth/Access/SocialAuthService.php index 2f1a6876a..8cf243fe7 100644 --- a/app/Auth/Access/SocialAuthService.php +++ b/app/Auth/Access/SocialAuthService.php @@ -2,15 +2,11 @@ namespace BookStack\Auth\Access; -use BookStack\Actions\ActivityType; use BookStack\Auth\SocialAccount; use BookStack\Auth\User; use BookStack\Exceptions\SocialDriverNotConfigured; use BookStack\Exceptions\SocialSignInAccountNotUsed; use BookStack\Exceptions\UserRegistrationException; -use BookStack\Facades\Activity; -use BookStack\Facades\Theme; -use BookStack\Theming\ThemeEvents; use Illuminate\Support\Facades\Event; use Illuminate\Support\Str; use Laravel\Socialite\Contracts\Factory as Socialite; @@ -28,6 +24,11 @@ class SocialAuthService */ protected $socialite; + /** + * @var LoginService + */ + protected $loginService; + /** * The default built-in social drivers we support. * @@ -59,9 +60,10 @@ class SocialAuthService /** * SocialAuthService constructor. */ - public function __construct(Socialite $socialite) + public function __construct(Socialite $socialite, LoginService $loginService) { $this->socialite = $socialite; + $this->loginService = $loginService; } /** @@ -139,9 +141,7 @@ class SocialAuthService // When a user is not logged in and a matching SocialAccount exists, // Simply log the user into the application. if (!$isLoggedIn && $socialAccount !== null) { - auth()->login($socialAccount->user); - Activity::add(ActivityType::AUTH_LOGIN, $socialAccount); - Theme::dispatch(ThemeEvents::AUTH_LOGIN, $socialDriver, $socialAccount->user); + $this->loginService->login($socialAccount->user, $socialAccount); return redirect()->intended('/'); }