From 803d7404b95183bf1df6f627617ae17e304ed0cb Mon Sep 17 00:00:00 2001 From: FoskyM Date: Mon, 2 Oct 2023 06:44:14 +0800 Subject: [PATCH] fix: location after authorized --- js/dist/forum.js | Bin 7326 -> 7237 bytes js/dist/forum.js.map | Bin 24677 -> 24355 bytes .../forum/components/oauth/AuthorizePage.js | 9 ++------- src/Controllers/AuthorizeController.php | 4 ++-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/js/dist/forum.js b/js/dist/forum.js index 4c8eaf1927b88490d10604e458d1307a9d9dd51e..5515709918327db8ccdb4c7641677eea631d460a 100644 GIT binary patch delta 604 zcmah`&ubGw7-cuqU}An^W19qxi-H91ZXV=+Ts&)$= z^ei}dm5K)sUX&a?3ksgRM-M{rA1Ge^lIXdYH$UF@zVFSO*WJ&Z4;iz_k!mr#Bbkb& zXmF~R&3SE`Yo!^n+mD5(cpw^5KQpfxTz@m4*EwBw_{G5C%_bHu@6kZCT6PKrKNM4%8mULYdX80he5ee^zk-8`(z8))EG&+Gk6 z)9`gUYXe@%z5x85{RP<0A^qdn&FQW~lEhNM117A~R1nFc5T>yW^*CfnvPEPND@G!w zkY!uAH4}fzbwPZPdw7IXx94y@%&)@Cz5E%A6E1xA=vE&o5_v($5XKI>)LyyFUDl)O z0@wTbMpKe7js{5KU5s0tasqGkHWiY%6%cR8A-#>MoN~QVI0;GLF7(Sj!V@cZxEeC_ z1YzXsamChu3X6t6DizZPxLPbBz;UIkcS;}Ox?QfPV7W2>a>9-)U;eQ_PdwH47tR6o zY9VW!+6LRfHW>!s0zQ}wBCF0eV$~Y- zpcgNKa}}w0^rGhISyAZ8d#xad|A2V)ZPR-%-@JL>oA=|J_j%=Y{e8mD0MQjrw}I;c z$PzHKXwR9Ny_Ovl!`?u4v{14n%v1Z41!mWNRs^=_!#U-H>r&Z(CTqj3!6uhFYJkZk zmPb1iZ!JrhwaFVt$Nrhj$FUPrk1_$%o+KglJ4!~n)HUJp;^^JfW&5ZsZ!p2fM9T`y zOtOY}A^8IFd-4}zHAT#i6YB@oO0HaXw7SEk!;Q=6AZ}3NIW)0nv0w zX$2T~I8djpiJ%qbb@~FOY8^ahV3wv&p{&=Zdoux{Uc~i=(0xuG5=sKIH(xXVrgK&> z%4Vi4>?)TfhiB=|DujX)T<=u;&X& z>v8N>@nAg#B);J1%95sP+_ZEZ=D4~co79h4VB8Da(B6ztudV>z(X9ap*I9L3<=s|7 z5~u7?e+!jSTV7w`ptvwz0KCTl1sGQNklaL}DjN*f$$ZKAmN0hy8@9TeXNZZyMa1>O aRjX@W6>76%A)+WwGl)2p%P7Tuq4yvC$K*2r diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index c314cbb2fb74d137def3cca5fd099869976ea448..36873d769e9b5f811b86fa4bc04249530a6c41f0 100644 GIT binary patch delta 456 zcmXw#Jx>Bb5QcNw2!?25PR@kH5HZREA|H{)WNugvIF17kBvyo2z@gmnVKA|?v(>GQ zg^iUlx!(8}Ozf@nces1RW@qy5%=pAYHzU3z;82C~LfB_`wy?RS1n}i+$>(~H70Von%1uSJ)R8A`glvDt8GU8GVi4I^81gxfzIkFX*m52dg7W^OG zPXKd7xrmNBX5VrNT*_m?L}CG0b5&S~d7flWC}{!?kZ7Qlgo1O*-2wRH)Z?n?t!wtX znLHk7A_&Ab)X3R?+Y(!l*Zd-U_z35PA@!C1qGZ@fI2MQ(eJxjJx8a=?x99`iu-9<3 z%88p|wF4+YuW6b&{pQiB^q_*meiVhib$rb<&AQ_X#k2MhyDDwd{}A|zHBC<7fJZ6u^W zz=ezF!kr5jx-?<0#y{ZNAK(vgXIy#jn=r||d2{bM=bdxk$FG6k-veJhEC-#c$C(Y? z>iqMvdqp)uVYMELEsbSS1w!F@BlIa~K!KS6Aeh9JSs>~;+DgeB4kEv$Zbmla_auQV z*2hv=APOo>fGBlxsu`&zCV5r?us3wa(r1D_kXRHh_teiw{*w6SnI!27E8r=4U`+#6_HLX$NB>=9X!n_SmQq*u$+YIP(=1>5DU4REOC&vnO?%;Mx8!?`)3 zQG(Twc%M@gd%!8oYmUAOnjwY~D>x1T7u9v@LM^N6(afV^fs)dk0Ltuev3*Joz$xmF zKplk8R6QLSa1_+vP(Pxp!M^{~G1Z^woonYg?POaeVz)~Z$@YkP0D{5@xufp_$g-8? zY#(5s^*9tTBnk@O8riJB656H7EMaYlp?VYB3F9pFP0_7Y1+fp@y!sVO1kTjoSTS%h zhxpxu`nH{(zkkq;U!I7s2AAv2te zI;mE2+MDerr#|MWcRXvQ7qHo4LrN3x6pujoxZ{j6K0M={yik>LFl@{oC#R&@9XM`k qZFMa@Yduu|p4?hO+B{XuUBCLAcvD;f!d80t5?sA)zWWdVblm0u diff --git a/js/src/forum/components/oauth/AuthorizePage.js b/js/src/forum/components/oauth/AuthorizePage.js index 6d31f91..522ba40 100644 --- a/js/src/forum/components/oauth/AuthorizePage.js +++ b/js/src/forum/components/oauth/AuthorizePage.js @@ -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 diff --git a/src/Controllers/AuthorizeController.php b/src/Controllers/AuthorizeController.php index b004f71..7313f2a 100644 --- a/src/Controllers/AuthorizeController.php +++ b/src/Controllers/AuthorizeController.php @@ -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') ]); }