Updated okta config keys, made SVG fully vector

Also added some additional error handling to login.
This commit is contained in:
Dan Brown 2017-12-09 13:32:45 +00:00
parent d17eb0f54c
commit 90bf13c1ab
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
5 changed files with 22 additions and 6 deletions

View File

@ -250,15 +250,27 @@ class RegisterController extends Controller
/**
* The callback for social login services.
* @param $socialDriver
* @param Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws SocialSignInException
* @throws UserRegistrationException
* @throws \BookStack\Exceptions\SocialDriverNotConfigured
* @throws ConfirmationEmailException
*/
public function socialCallback($socialDriver)
public function socialCallback($socialDriver, Request $request)
{
if (!session()->has('social-callback')) {
throw new SocialSignInException(trans('errors.social_no_action_defined'), '/login');
}
// Check request for error information
if ($request->has('error') && $request->has('error_description')) {
throw new SocialSignInException(trans('errors.social_login_bad_response', [
'socialAccount' => $socialDriver,
'error' => $request->get('error_description'),
]), '/login');
}
$action = session()->pull('social-callback');
if ($action == 'login') return $this->socialAuthService->handleLoginCallback($socialDriver);
if ($action == 'register') return $this->socialRegisterCallback($socialDriver);
@ -279,7 +291,9 @@ class RegisterController extends Controller
* Register a new user after a registration callback.
* @param $socialDriver
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws ConfirmationEmailException
* @throws UserRegistrationException
* @throws \BookStack\Exceptions\SocialDriverNotConfigured
*/
protected function socialRegisterCallback($socialDriver)
{

View File

@ -1,5 +1,7 @@
<?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;
@ -91,7 +93,6 @@ class SocialAuthService
public function handleLoginCallback($socialDriver)
{
$driver = $this->validateDriver($socialDriver);
// Get user details from social driver
$socialUser = $this->socialite->driver($driver)->user();
$socialId = $socialUser->getId();
@ -135,7 +136,7 @@ class SocialAuthService
$message .= trans('errors.social_account_register_instructions', ['socialAccount' => title_case($socialDriver)]);
}
throw new SocialSignInException($message . '.', '/login');
throw new SocialSignInException($message, '/login');
}
/**

View File

@ -81,8 +81,8 @@ return [
],
'okta' => [
'client_id' => env('OKTA_KEY'),
'client_secret' => env('OKTA_SECRET'),
'client_id' => env('OKTA_APP_ID'),
'client_secret' => env('OKTA_APP_SECRET'),
'redirect' => env('APP_URL') . '/login/service/okta/callback',
'base_url' => env('OKTA_BASE_URL'),
'name' => 'Okta',

View File

@ -1 +1 @@
<svg viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><use id="image0" xlink:href="#_Image1" x="0" y="0" width="64px" height="64px"/><defs><image id="_Image1" width="24px" height="24px" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAA7EAAAOxAGVKw4bAAACU0lEQVRIiaWVTUiUURSGn3PnGyXDrAjaVEIlGG2ElhHjT4RR6aZFtGgR1KaNFBjliJg/lT9tohbtWlvQD4SLUMehVhFBm3IpQYlZljSOOXNPixl/596Z0d7VcJ7zvufeb+79PiGfrj8vI7w9jlAJVABBlvwFZrH2HWKa6Y6kfBHirEbHqhAZBvbnXcCK3qC2ie66H+uByWltj7UiMrGBcICjiJkhOnYm/4CO+BPg7gaC10rkBdGxm2tKy7/ax6+BDmw6fLVU6+muHV0Z0Bbfi7GThWyAzXpyH+162YUt9JxIZhqNfZWnNY3qcVTLmTQBidkAayuw6SvZoW5JyYPMDqIjO5BQzr+f1QTjI9XEOt1BrcNbKS37Clru5F0RMUjooXflU78OecMB+hr/YNV/2m68bjZAgxOqvcijJus1L6kn8h2Vp04WhPsM4Nqeouo2OWVbPKDCACUOsIglWXS+6m8PKTW4T4Igxv0acct3bNUACw4QBrYVH292esi8AX46kXCn6AFi3nrItMHqffeq5BJtowcLhnfEm1G728kSiUZDYu6e12zMZ6KxGi9vj53C2mceahk8+U2yjUPAWW+Q6geUcximsBiwBzChIaDS64FWuiL9mS9UKnWeIPAPEKlB+JTZFUAoTy4ASRJzA8vt3G5YRMyRQq4iZUmn9zF4WlcGANw69p5QcOE/w9PAYXrrp5cKuZcpOl6F6MTm4nUXvbUzq0vu23r1paGsvB+RFgp/XJJAJ10R570p/DpoG6lGQo8R9gCl2eo8qh9RvUxP3Zd89n+rAbY6AaOFBwAAAABJRU5ErkJggg=="/></defs></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm-.035 5.537a6.427 6.427 0 0 1 6.428 6.428 6.427 6.427 0 0 1-6.428 6.428 6.427 6.427 0 0 1-6.428-6.428 6.427 6.427 0 0 1 6.428-6.428z" fill="#007dc1"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 392 B

View File

@ -20,6 +20,7 @@ return [
'ldap_extension_not_installed' => 'LDAP PHP extension not installed',
'ldap_cannot_connect' => 'Cannot connect to ldap server, Initial connection failed',
'social_no_action_defined' => 'No action defined',
'social_login_bad_response' => "Error received during :socialAccount login: \n:error",
'social_account_in_use' => 'This :socialAccount account is already in use, Try logging in via the :socialAccount option.',
'social_account_email_in_use' => 'The email :email is already in use. If you already have an account you can connect your :socialAccount account from your profile settings.',
'social_account_existing' => 'This :socialAccount is already attached to your profile.',