<?php namespace BookStack\Services;
+use BookStack\Http\Requests\Request;
+use GuzzleHttp\Exception\ClientException;
use Laravel\Socialite\Contracts\Factory as Socialite;
use BookStack\Exceptions\SocialDriverNotConfigured;
use BookStack\Exceptions\SocialSignInException;
protected $socialite;
protected $socialAccount;
- protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter'];
+ protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta', 'gitlab', 'twitch'];
/**
* SocialAuthService constructor.
public function handleLoginCallback($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
-
// Get user details from social driver
$socialUser = $this->socialite->driver($driver)->user();
$socialId = $socialUser->getId();
$message .= trans('errors.social_account_register_instructions', ['socialAccount' => title_case($socialDriver)]);
}
- throw new SocialSignInException($message . '.', '/login');
+ throw new SocialSignInException($message, '/login');
}
/**
{
$driver = trim(strtolower($socialDriver));
- if (!in_array($driver, $this->validSocialDrivers)) abort(404, trans('errors.social_driver_not_found'));
- if (!$this->checkDriverConfigured($driver)) throw new SocialDriverNotConfigured(trans('errors.social_driver_not_configured', ['socialAccount' => title_case($socialDriver)]));
+ if (!in_array($driver, $this->validSocialDrivers)) {
+ abort(404, trans('errors.social_driver_not_found'));
+ }
+ if (!$this->checkDriverConfigured($driver)) {
+ throw new SocialDriverNotConfigured(trans('errors.social_driver_not_configured', ['socialAccount' => title_case($socialDriver)]));
+ }
return $driver;
}
session()->flash('success', trans('settings.users_social_disconnected', ['socialAccount' => title_case($socialDriver)]));
return redirect(user()->getEditUrl());
}
-
-}
\ No newline at end of file
+}