fix: authorize
This commit is contained in:
parent
19a17bc851
commit
6e2aeffb43
4 changed files with 17 additions and 12 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.
|
@ -14,6 +14,7 @@ export default class AuthorizePage extends IndexPage {
|
||||||
client_scope = [];
|
client_scope = [];
|
||||||
loading = true;
|
loading = true;
|
||||||
is_authorized = false;
|
is_authorized = false;
|
||||||
|
submit_loading = false;
|
||||||
|
|
||||||
oninit(vnode) {
|
oninit(vnode) {
|
||||||
super.oninit(vnode);
|
super.oninit(vnode);
|
||||||
|
@ -76,7 +77,7 @@ export default class AuthorizePage extends IndexPage {
|
||||||
scopes_temp = scopes_temp.concat(default_scopes);
|
scopes_temp = scopes_temp.concat(default_scopes);
|
||||||
|
|
||||||
this.client_scope = scopes_temp.filter((scope, index) => scopes_temp.indexOf(scope) === index);
|
this.client_scope = scopes_temp.filter((scope, index) => scopes_temp.indexOf(scope) === index);
|
||||||
console.log( this.client_scope );
|
console.log(this.client_scope);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
m.redraw();
|
m.redraw();
|
||||||
});
|
});
|
||||||
|
@ -135,9 +136,9 @@ export default class AuthorizePage extends IndexPage {
|
||||||
<div class="oauth-scope-left">
|
<div class="oauth-scope-left">
|
||||||
{
|
{
|
||||||
(scope_info.scope_icon().indexOf('fa-') > -1) ?
|
(scope_info.scope_icon().indexOf('fa-') > -1) ?
|
||||||
<i class={"oauth-scope-object fa-2x " + scope_info.scope_icon()}
|
<i class={"oauth-scope-object fa-2x " + scope_info.scope_icon()}
|
||||||
style="margin-left:2px;color:#000"></i> :
|
style="margin-left:2px;color:#000"></i> :
|
||||||
<img class="oauth-scope-object" src={scope_info.scope_icon()} style="width:32px"/>
|
<img class="oauth-scope-object" src={scope_info.scope_icon()} style="width:32px"/>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="oauth-scope-body">
|
<div class="oauth-scope-body">
|
||||||
|
@ -158,7 +159,7 @@ export default class AuthorizePage extends IndexPage {
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<form class="oauth-form" method="post" id="form" onsubmit={this.onsubmit.bind(this)}>
|
<form class="oauth-form" method="post" id="form" onsubmit={this.onsubmit.bind(this)}>
|
||||||
{/* <input type="hidden" name="response_type" value={this.params.response_type}/>
|
{/* <input type="hidden" name="response_type" value={this.params.response_type}/>
|
||||||
<input type="hidden" name="client_id" value={this.params.client_id}/>
|
<input type="hidden" name="client_id" value={this.params.client_id}/>
|
||||||
<input type="hidden" name="redirect_uri"
|
<input type="hidden" name="redirect_uri"
|
||||||
value={this.params.redirect_uri}/>
|
value={this.params.redirect_uri}/>
|
||||||
|
@ -166,14 +167,12 @@ export default class AuthorizePage extends IndexPage {
|
||||||
<input type="hidden" name="scope" value={this.params.scope}/>*/}
|
<input type="hidden" name="scope" value={this.params.scope}/>*/}
|
||||||
<input type="hidden" name="is_authorized" value={this.is_authorized}/>
|
<input type="hidden" name="is_authorized" value={this.is_authorized}/>
|
||||||
<div style="display: flex; margin-top: 15px" class="oauth-form-item">
|
<div style="display: flex; margin-top: 15px" class="oauth-form-item">
|
||||||
<Button className="Button" type="submit" style="width: 50%;" onclick={
|
<Button className="Button" type="submit" style="width: 50%;" onclick={this.deny.bind(this)}
|
||||||
this.is_authorized = false
|
loading={this.submit_loading}>
|
||||||
}>
|
|
||||||
{app.translator.trans('foskym-oauth-center.forum.authorize.deny')}
|
{app.translator.trans('foskym-oauth-center.forum.authorize.deny')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button className="Button Button--primary" type="submit" style="width: 50%;" onclick={
|
<Button className="Button Button--primary" type="submit" style="width: 50%;"
|
||||||
this.is_authorized = true
|
onclick={this.agree.bind(this)} loading={this.submit_loading}>
|
||||||
}>
|
|
||||||
{app.translator.trans('foskym-oauth-center.forum.authorize.agree')}
|
{app.translator.trans('foskym-oauth-center.forum.authorize.agree')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -187,6 +186,12 @@ export default class AuthorizePage extends IndexPage {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
deny(e) {
|
||||||
|
this.is_authorized = false;
|
||||||
|
}
|
||||||
|
agree(e) {
|
||||||
|
this.is_authorized = true;
|
||||||
|
}
|
||||||
|
|
||||||
onsubmit(e) {
|
onsubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
@ -45,7 +45,7 @@ class AuthorizeController implements RequestHandlerInterface
|
||||||
return new JsonResponse(json_decode($response->getResponseBody(), true));
|
return new JsonResponse(json_decode($response->getResponseBody(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_authorized = (Arr::get($params, 'authorized', 'no') === 'yes');
|
$is_authorized = Arr::get($params, 'is_authorized', 0);
|
||||||
$server->handleAuthorizeRequest($request, $response, $is_authorized, $actor->id);
|
$server->handleAuthorizeRequest($request, $response, $is_authorized, $actor->id);
|
||||||
if ($is_authorized) {
|
if ($is_authorized) {
|
||||||
// this is only here so that you get to see your code in the cURL request. Otherwise, we'd redirect back to the client
|
// this is only here so that you get to see your code in the cURL request. Otherwise, we'd redirect back to the client
|
||||||
|
|
Loading…
Reference in a new issue