fix: location after authorized

This commit is contained in:
FoskyM 2023-10-02 06:44:14 +08:00
parent 2a7948fffd
commit 803d7404b9
No known key found for this signature in database
GPG key ID: 42C0ED6994AD7E9C
4 changed files with 4 additions and 9 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

@ -43,7 +43,7 @@ export default class AuthorizePage extends IndexPage {
if (app.forum.attribute('foskym-oauth-center.require_exact_redirect_uri') && uris.indexOf(params.redirect_uri) == -1) {
m.route.set('/');
}
if (app.forum.attribute('foskym-oauth-center.allow_implicit') && params.response_type == 'token') {
if (!app.forum.attribute('foskym-oauth-center.allow_implicit') && params.response_type == 'token') {
m.route.set('/');
}
if (app.forum.attribute('foskym-oauth-center.enforce_state') && params.enforce_state == null) {
@ -214,12 +214,7 @@ export default class AuthorizePage extends IndexPage {
is_authorized: this.is_authorized,
}
}).then((params) => {
let arr = []
for (let k in params) {
arr.push(`${k}=${params[k]}`)
}
let url = `${this.params.redirect_uri }?${arr.join('&')}`;
window.location.href = url;
window.location.href = params.location;
});
// Some form handling logic here

View file

@ -47,9 +47,9 @@ class AuthorizeController implements RequestHandlerInterface
$is_authorized = Arr::get($params, 'is_authorized', 0);
$server->handleAuthorizeRequest($request, $response, $is_authorized, $actor->id);
if ($is_authorized) {
$code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40);
// $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40);
return new JsonResponse([
'code' => $code
'location' => $response->getHttpHeader('Location')
]);
}