@@ -61,8 +61,6 @@ function getRandomURL() {
6161const secret = process . env . COOKIE_KEY || "secret" ;
6262app . use ( session ( {
6363 secret : secret ,
64- resave : false ,
65- saveUninitialized : true ,
6664} ) ) ;
6765
6866//-----------------------------------------------------------------------------
@@ -264,7 +262,6 @@ app.get('/login',
264262 resourceURL : config . resourceURL , // optional. Provide a value if you want to specify the resource.
265263 customState : 'my_state' , // optional. Provide a value if you want to provide custom state value.
266264 failureRedirect : '/error' ,
267- useCookieInsteadOfSession : true ,
268265 domain_hint : config . branding . domainHint
269266 }
270267 ) ( req , res , next ) ;
@@ -314,9 +311,10 @@ app.post('/auth/openid/return',
314311
315312// 'logout' route, logout from passport, and destroy the session with AAD.
316313app . 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 ;
320318 res . redirect ( '/' ) ;
321319} ) ;
322320
@@ -343,7 +341,12 @@ app.use(async (req, res, next) => {
343341// begin business logic
344342
345343app . get ( '/' , async function ( req , res ) {
344+
346345 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+
347350 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 } ) ;
348351 return
349352} )
0 commit comments