feat: get client info

This commit is contained in:
FoskyM 2023-10-01 17:30:18 +08:00
parent 8ad3fd087f
commit 7067581f44
No known key found for this signature in database
GPG key ID: 42C0ED6994AD7E9C
4 changed files with 35 additions and 0 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

@ -6,6 +6,7 @@ import LogInModal from 'flarum/forum/components/LogInModal';
import extractText from 'flarum/common/utils/extractText'; import extractText from 'flarum/common/utils/extractText';
export default class AuthorizePage extends IndexPage { export default class AuthorizePage extends IndexPage {
params = [];
oninit(vnode) { oninit(vnode) {
super.oninit(vnode); super.oninit(vnode);
if (!app.session.user) { if (!app.session.user) {
@ -13,6 +14,13 @@ export default class AuthorizePage extends IndexPage {
} }
const params = m.route.param(); const params = m.route.param();
if (params.client_id == null || params.response_type == null || params.redirect_uri == null) {
m.route.set('/');
} else {
this.params = params;
}
} }
setTitle() { setTitle() {

View file

@ -0,0 +1,27 @@
<?php
namespace FoskyM\OAuthCenter\Api\Controller;
use Flarum\Api\Controller\AbstractListController;
use Flarum\Http\RequestUtil;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;
use FoskyM\OAuthCenter\Models\Client;
use FoskyM\OAuthCenter\Api\Serializer\ClientSerializer;
class ShowClientController extends AbstractListController
{
public $serializer = ClientSerializer::class;
protected function data(ServerRequestInterface $request, Document $document)
{
$id = Arr::get($request->getQueryParams(), 'id');
RequestUtil::getActor($request)->assertUser();
$client = Client::findOrFail($id);
$client->client_secret = '<PROTECT>';
return $client;
}
}