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 { export default class AuthorizePage extends IndexPage {
params = []; params = [];
client = null;
oninit(vnode) { oninit(vnode) {
super.oninit(vnode); super.oninit(vnode);
if (!app.session.user) { if (!app.session.user) {
@ -19,7 +20,9 @@ export default class AuthorizePage extends IndexPage {
m.route.set('/'); m.route.set('/');
} else { } else {
this.params = params; 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; public $serializer = ClientSerializer::class;
protected function data(ServerRequestInterface $request, Document $document) 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(); RequestUtil::getActor($request)->assertUser();
$client = Client::findOrFail($id); $client = Client::whereOrFail('client_id', $client_id);
$client->client_secret = '<PROTECT>'; $client->client_secret = '<PROTECT>';
return $client; return $client;