File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ module.exports = function(config, options) {
173173 }
174174
175175 app . get ( '/login' , csrf ( ) , function ( req , res ) {
176- const redirectURL = req . url . includes ( '?redirect=' ) && req . url . split ( '?redirect=' ) [ 1 ] ;
176+ const redirectURL = req . url . includes ( '?redirect=' ) && req . url . split ( '?redirect=' ) [ 1 ] . length > 1 && req . url . split ( '?redirect=' ) [ 1 ] ;
177177 if ( ! users || ( req . user && req . user . isAuthenticated ) ) {
178178 return res . redirect ( `${ mountPath } ${ redirectURL || 'apps' } ` ) ;
179179 }
@@ -207,7 +207,11 @@ module.exports = function(config, options) {
207207 // For every other request, go to index.html. Let client-side handle the rest.
208208 app . get ( '/*' , function ( req , res ) {
209209 if ( users && ( ! req . user || ! req . user . isAuthenticated ) ) {
210- return res . redirect ( `${ mountPath } login?redirect=${ req . url . replace ( '/login' , '' ) } ` ) ;
210+ const redirect = req . url . replace ( '/login' , '' ) ;
211+ if ( redirect . length > 1 ) {
212+ return res . redirect ( `${ mountPath } login?redirect=${ redirect } ` ) ;
213+ }
214+ return res . redirect ( `${ mountPath } login` ) ;
211215 }
212216 if ( users && req . user && req . user . matchingUsername ) {
213217 res . append ( 'username' , req . user . matchingUsername ) ;
Original file line number Diff line number Diff line change @@ -32,9 +32,8 @@ export default class DashboardView extends React.Component {
3232 }
3333
3434 onRouteChanged ( ) {
35- const appId = this . context . applicationId ;
3635 const path = this . props . location ?. pathname ?? window . location . pathname ;
37- const route = path . split ( appId ) [ 1 ] . split ( '/' ) [ 1 ] ;
36+ const route = path . split ( 'apps' ) [ 1 ] . split ( '/' ) [ 2 ] ;
3837 if ( route !== this . state . route ) {
3938 this . setState ( { route } ) ;
4039 }
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export default class Login extends React.Component {
3434 forgot : false ,
3535 username : sessionStorage . getItem ( 'username' ) || '' ,
3636 password : sessionStorage . getItem ( 'password' ) || '' ,
37- redirect
37+ redirect : redirect !== '/' ? redirect : undefined
3838 } ;
3939 sessionStorage . clear ( ) ;
4040 setBasePath ( props . path ) ;
You can’t perform that action at this time.
0 commit comments