File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed
staff-dashboard/src/pages Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,11 @@ export const generateLoginRedirectUrl = () => {
5858 const { pathname, search, hash } = window . location
5959
6060 const next = `${ pathname } ${ search } ${ hash } `
61+
62+ if ( SETTINGS . api_gateway_enabled ) {
63+ window . location = `/login/?${ qs . stringify ( { next } ) } `
64+ return
65+ }
6166 return `${ routes . login . begin } ?${ qs . stringify ( { next } ) } `
6267}
6368
Original file line number Diff line number Diff line change @@ -23,6 +23,18 @@ describe("auth lib function", () => {
2323 )
2424 } )
2525
26+ it ( "generateLoginRedirectUrl should set window.location to /login/ w/ a redirect url" , ( ) => {
27+ global . SETTINGS = {
28+ api_gateway_enabled : true
29+ }
30+ window . location = "/protected/route?var=abc"
31+ generateLoginRedirectUrl ( )
32+ assert . equal (
33+ window . location . toString ( ) ,
34+ "http://fake/login/?next=%2Fprotected%2Froute%3Fvar%3Dabc"
35+ )
36+ } )
37+
2638 describe ( "handleAuthResponse" , ( ) => {
2739 let history , sandbox
2840
Original file line number Diff line number Diff line change 11export default function LoginPage ( ) {
2- const sign_in_url = ( new URL ( DATASOURCES_CONFIG . mitxOnline ) ) . origin + "/signin/?next=/staff-dashboard/" ;
2+ const sign_in_url =
3+ new URL ( DATASOURCES_CONFIG . mitxOnline ) . origin +
4+ "/signin/?next=/staff-dashboard/" ;
35
4- document . location = sign_in_url ;
6+ document . location = sign_in_url ;
57
6- return ( < > Please wait while we redirect you to the sign in page...</ > ) ;
7-
8- } ;
8+ return < > Please wait while we redirect you to the sign in page...</ > ;
9+ }
You can’t perform that action at this time.
0 commit comments