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) {
173
173
}
174
174
175
175
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 ] ;
177
177
if ( ! users || ( req . user && req . user . isAuthenticated ) ) {
178
178
return res . redirect ( `${ mountPath } ${ redirectURL || 'apps' } ` ) ;
179
179
}
@@ -207,7 +207,11 @@ module.exports = function(config, options) {
207
207
// For every other request, go to index.html. Let client-side handle the rest.
208
208
app . get ( '/*' , function ( req , res ) {
209
209
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` ) ;
211
215
}
212
216
if ( users && req . user && req . user . matchingUsername ) {
213
217
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 {
32
32
}
33
33
34
34
onRouteChanged ( ) {
35
- const appId = this . context . applicationId ;
36
35
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 ] ;
38
37
if ( route !== this . state . route ) {
39
38
this . setState ( { route } ) ;
40
39
}
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export default class Login extends React.Component {
34
34
forgot : false ,
35
35
username : sessionStorage . getItem ( 'username' ) || '' ,
36
36
password : sessionStorage . getItem ( 'password' ) || '' ,
37
- redirect
37
+ redirect : redirect !== '/' ? redirect : undefined
38
38
} ;
39
39
sessionStorage . clear ( ) ;
40
40
setBasePath ( props . path ) ;
You can’t perform that action at this time.
0 commit comments