OAuth: Allow - in URLs and fix response handling

This commit is contained in:
Igor Scheller 2020-12-26 16:09:39 +01:00
parent d7152ebc09
commit 304b599cf4
2 changed files with 10 additions and 4 deletions

View File

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

View File

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