@@ -61,8 +61,6 @@ function getRandomURL() {
61
61
const secret = process . env . COOKIE_KEY || "secret" ;
62
62
app . use ( session ( {
63
63
secret : secret ,
64
- resave : false ,
65
- saveUninitialized : true ,
66
64
} ) ) ;
67
65
68
66
//-----------------------------------------------------------------------------
@@ -264,7 +262,6 @@ app.get('/#',
264
262
resourceURL : config . resourceURL , // optional. Provide a value if you want to specify the resource.
265
263
customState : 'my_state' , // optional. Provide a value if you want to provide custom state value.
266
264
failureRedirect : '/error' ,
267
- useCookieInsteadOfSession : true ,
268
265
domain_hint : config . branding . domainHint
269
266
}
270
267
) ( req , res , next ) ;
@@ -314,9 +311,10 @@ app.post('/auth/openid/return',
314
311
315
312
// 'logout' route, logout from passport, and destroy the session with AAD.
316
313
app . get ( '/logout' , function ( req , res ) {
317
- res . clearCookie ( 'connect.sid' ) ;
318
- res . clearCookie ( 'session' ) ;
319
- res . clearCookie ( 'session.sig' ) ;
314
+ res . clearCookie ( 'connect.sid' , { path :'/' } ) ;
315
+ res . clearCookie ( 'session' , { path :'/' } ) ;
316
+ res . clearCookie ( 'session.sig' , { path :'/' } ) ;
317
+ req . session = null ;
320
318
res . redirect ( '/' ) ;
321
319
} ) ;
322
320
@@ -343,7 +341,12 @@ app.use(async (req, res, next) => {
343
341
// begin business logic
344
342
345
343
app . get ( '/' , async function ( req , res ) {
344
+
346
345
if ( req . isAuthenticated ( ) ) { return res . redirect ( '/create' ) }
346
+ res . clearCookie ( 'connect.sid' , { path :'/' } ) ;
347
+ res . clearCookie ( 'session' , { path :'/' } ) ;
348
+ res . clearCookie ( 'session.sig' , { path :'/' } ) ;
349
+
347
350
res . render ( 'home.html' , { partials, productName : config . branding . title , logoPath : config . branding . logoPath , copyrightOwner : config . branding . copyrightOwner , statusURL : config . branding . statusURL , orgHome : config . branding . orgHome , loginProvider : config . branding . loginProvider } ) ;
348
351
return
349
352
} )
0 commit comments