feat: get client info
This commit is contained in:
parent
8ad3fd087f
commit
7067581f44
4 changed files with 35 additions and 0 deletions
BIN
js/dist/forum.js
generated
vendored
BIN
js/dist/forum.js
generated
vendored
Binary file not shown.
BIN
js/dist/forum.js.map
generated
vendored
BIN
js/dist/forum.js.map
generated
vendored
Binary file not shown.
|
@ -6,6 +6,7 @@ import LogInModal from 'flarum/forum/components/LogInModal';
|
|||
import extractText from 'flarum/common/utils/extractText';
|
||||
|
||||
export default class AuthorizePage extends IndexPage {
|
||||
params = [];
|
||||
oninit(vnode) {
|
||||
super.oninit(vnode);
|
||||
if (!app.session.user) {
|
||||
|
@ -13,6 +14,13 @@ export default class AuthorizePage extends IndexPage {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
27
src/Api/Controller/ShowClientController.php
Normal file
27
src/Api/Controller/ShowClientController.php
Normal 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;
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue