feat: get client info

This commit is contained in:
FoskyM 2023-10-01 17:34:20 +08:00
parent 7067581f44
commit 44584fb882
No known key found for this signature in database
GPG key ID: 42C0ED6994AD7E9C
4 changed files with 6 additions and 3 deletions

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

@ -7,6 +7,7 @@ import extractText from 'flarum/common/utils/extractText';
export default class AuthorizePage extends IndexPage {
params = [];
client = null;
oninit(vnode) {
super.oninit(vnode);
if (!app.session.user) {
@ -19,7 +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 => {
this.client = client;
});
}
}

View file

@ -15,10 +15,10 @@ class ShowClientController extends AbstractListController
public $serializer = ClientSerializer::class;
protected function data(ServerRequestInterface $request, Document $document)
{
$id = Arr::get($request->getQueryParams(), 'id');
$client_id = Arr::get($request->getQueryParams(), 'client_id');
RequestUtil::getActor($request)->assertUser();
$client = Client::findOrFail($id);
$client = Client::whereOrFail('client_id', $client_id);
$client->client_secret = '<PROTECT>';
return $client;