OAuth: Allow - in URLs and fix response handling

main
Igor Scheller 4 years ago
parent d7152ebc09
commit 304b599cf4

@ -15,9 +15,9 @@ $route->post('/login', 'AuthController@postLogin');
$route->get('/logout', 'AuthController@logout'); $route->get('/logout', 'AuthController@logout');
// OAuth // OAuth
$route->get('/oauth/{provider:\w+}', 'OAuthController@index'); $route->get('/oauth/{provider}', 'OAuthController@index');
$route->post('/oauth/{provider:\w+}/connect', 'OAuthController@connect'); $route->post('/oauth/{provider}/connect', 'OAuthController@connect');
$route->post('/oauth/{provider:\w+}/disconnect', 'OAuthController@disconnect'); $route->post('/oauth/{provider}/disconnect', 'OAuthController@disconnect');
// User settings // User settings
$route->get('/settings/password', 'SettingsController@password'); $route->get('/settings/password', 'SettingsController@password');

@ -113,12 +113,14 @@ class OAuthController extends BaseController
] ]
); );
} catch (IdentityProviderException $e) { } catch (IdentityProviderException $e) {
$response = $e->getResponseBody();
$response = is_array($response) ? json_encode($response) : $response;
$this->log->error( $this->log->error(
'{provider} identity provider error: {error} {description}', '{provider} identity provider error: {error} {description}',
[ [
'provider' => $providerName, 'provider' => $providerName,
'error' => $e->getMessage(), 'error' => $e->getMessage(),
'description' => $e->getResponseBody()['error_description'] ?: '', 'description' => $response,
] ]
); );
@ -297,6 +299,10 @@ class OAuthController extends BaseController
throw new HttpNotFound('oauth.not-found'); throw new HttpNotFound('oauth.not-found');
} }
$config = array_merge(
['username' => null, 'email' => null, 'first_name' => null, 'last_name' => null],
$config
);
$this->session->set( $this->session->set(
'form_data', 'form_data',
[ [

Loading…
Cancel
Save