File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { z } from "zod" ;
22
33export const oidcParamsSchema = z . object ( {
4- scope : z . string ( ) ,
5- response_type : z . string ( ) ,
6- client_id : z . string ( ) ,
7- redirect_uri : z . string ( ) ,
4+ scope : z . string ( ) . nonempty ( ) ,
5+ response_type : z . string ( ) . nonempty ( ) ,
6+ client_id : z . string ( ) . nonempty ( ) ,
7+ redirect_uri : z . string ( ) . nonempty ( ) ,
88 state : z . string ( ) . optional ( ) ,
99 nonce : z . string ( ) . optional ( ) ,
1010 code_challenge : z . string ( ) . optional ( ) ,
1111 code_challenge_method : z . string ( ) . optional ( ) ,
12- prompt : z . string ( ) . optional ( ) ,
1312} ) ;
1413
1514export const useOIDCParams = (
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ export const AuthorizePage = () => {
7878 queryKey : [ "client" , oidcParams . values . client_id ] ,
7979 queryFn : async ( ) => {
8080 const res = await fetch (
81- `/api/oidc/clients/${ oidcParams . values . client_id } ` ,
81+ `/api/oidc/clients/${ encodeURIComponent ( oidcParams . values . client_id ) } ` ,
8282 ) ;
8383 const data = await getOidcClientInfoSchema . parseAsync ( await res . json ( ) ) ;
8484 return data ;
Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ export const LoginPage = () => {
106106 mutationKey : [ "login" ] ,
107107 onSuccess : ( data ) => {
108108 if ( data . data . totpPending ) {
109+ if ( oidcParams . isOidc ) {
110+ window . location . replace ( `/totp?${ oidcParams . compiled } ` ) ;
111+ return ;
112+ }
109113 window . location . replace (
110114 `/totp${ redirectUri ? `?redirect_uri=${ encodeURIComponent ( redirectUri ) } ` : "" } ` ,
111115 ) ;
@@ -171,7 +175,7 @@ export const LoginPage = () => {
171175 return < Navigate to = { `/authorize?${ oidcParams . compiled } ` } replace /> ;
172176 }
173177
174- if ( isLoggedIn && redirectUri !== "" ) {
178+ if ( isLoggedIn && redirectUri !== undefined ) {
175179 return (
176180 < Navigate
177181 to = { `/continue${ redirectUri ? `?redirect_uri=${ encodeURIComponent ( redirectUri ) } ` : "" } ` }
You can’t perform that action at this time.
0 commit comments