@@ -143,6 +143,10 @@ export class AuthRoutes implements IREST {
143
143
handleError ( "Login error; user not valid." ) ;
144
144
}
145
145
} ) . then ( function ( isPrivileged ) {
146
+ if ( typeof isPrivileged === 'undefined' ) {
147
+ Log . warn ( 'RouteHandler::getCredentials(..) - failsafe; DEBUG this case?' ) ;
148
+ isPrivileged = { isAdmin : false , isStaff : false } ; // fail safe
149
+ }
146
150
payload = { success : { personId : user , token : token , isAdmin : isPrivileged . isAdmin , isStaff : isPrivileged . isStaff } } ;
147
151
Log . info ( 'RouteHandler::getCredentials(..) - sending 200; isPriv: ' + ( isPrivileged . isStaff || isPrivileged . isAdmin ) ) ;
148
152
res . send ( 200 , payload ) ;
@@ -267,7 +271,7 @@ export class AuthRoutes implements IREST {
267
271
// auth written (or not); we only really care about the state of p at this point
268
272
269
273
270
- Log . info ( "AuthRouteHandler ::authCallback(..) - preparing redirect for: " + JSON . stringify ( p ) ) ;
274
+ Log . info ( "AuthRoutes ::authCallback(..) - preparing redirect for: " + JSON . stringify ( p ) ) ;
271
275
let feUrl = config . getProp ( ConfigKey . backendUrl ) ;
272
276
let fePort = config . getProp ( ConfigKey . backendPort ) ;
273
277
@@ -279,7 +283,7 @@ export class AuthRoutes implements IREST {
279
283
if ( feUrl . indexOf ( '//' ) > 0 ) {
280
284
feUrl = feUrl . substr ( feUrl . indexOf ( '//' ) + 2 , feUrl . length ) ;
281
285
}
282
- Log . trace ( "RouteHandler ::authCallback(..) - /authCallback - redirect homepage URL: " + feUrl ) ;
286
+ Log . trace ( "AuthRoutes ::authCallback(..) - /authCallback - redirect homepage URL: " + feUrl ) ;
283
287
284
288
res . redirect ( {
285
289
hostname : feUrl ,
@@ -289,7 +293,7 @@ export class AuthRoutes implements IREST {
289
293
} , next ) ;
290
294
} else {
291
295
292
- Log . trace ( "RouteHandler ::authCallback(..) - /authCallback - redirect logout URL: " + feUrl ) ;
296
+ Log . trace ( "AuthRoutes ::authCallback(..) - /authCallback - redirect logout URL: " + feUrl ) ;
293
297
294
298
res . redirect ( {
295
299
hostname : feUrl ,
@@ -299,7 +303,7 @@ export class AuthRoutes implements IREST {
299
303
}
300
304
} ) . catch ( function ( err ) {
301
305
// code incorrect or expired
302
- Log . error ( "AuthRouteHandler ::authCallback(..) - /authCallback - ERROR: " + err ) ;
306
+ Log . error ( "AuthRoutes ::authCallback(..) - /authCallback - ERROR: " + err ) ;
303
307
// NOTE: should this be returning 400 or something?
304
308
return next ( ) ;
305
309
} ) ;
0 commit comments