fix: get client info

This commit is contained in:
FoskyM 2023-10-01 17:41:52 +08:00
parent 44584fb882
commit 35d9f280fb
No known key found for this signature in database
GPG key ID: 42C0ED6994AD7E9C
5 changed files with 8 additions and 3 deletions

View file

@ -31,6 +31,7 @@ return [
(new Extend\Routes('api'))
->get('/oauth-clients', 'oauth.clients.list', Api\Controller\ListClientController::class)
->post('/oauth-clients', 'oauth.clients.create', Api\Controller\CreateClientController::class)
->get('/oauth-clients/{client_id}', 'oauth.clients.show', Api\Controller\ShowClientController::class)
->patch('/oauth-clients/{id}', 'oauth.clients.update', Api\Controller\UpdateClientController::class)
->delete('/oauth-clients/{id}', 'oauth.clients.delete', Api\Controller\DeleteClientController::class),

BIN
js/dist/forum.js generated vendored

Binary file not shown.

BIN
js/dist/forum.js.map generated vendored

Binary file not shown.

View file

@ -20,8 +20,9 @@ export default class AuthorizePage extends IndexPage {
m.route.set('/');
} else {
this.params = params;
app.store.find('oauth-clients', {'client_id': params.client_id}).then(client => {
app.store.find('oauth-clients', params.client_id).then(client => {
this.client = client;
console.log(client);
});
}
}

View file

@ -16,10 +16,13 @@ class ShowClientController extends AbstractListController
protected function data(ServerRequestInterface $request, Document $document)
{
$client_id = Arr::get($request->getQueryParams(), 'client_id');
RequestUtil::getActor($request)->assertUser();
RequestUtil::getActor($request)->assertRegistered();
$client = Client::whereOrFail('client_id', $client_id);
$client->client_secret = '<PROTECT>';
if (isset($client->client_secret)) {
$client->client_secret = '<PROTECT>';
}
return $client;