@@ -136,21 +136,9 @@ adminControllers = {
136136 if ( ! denied ) {
137137 loginSecurity . push ( { ip : req . connection . remoteAddress , time : process . hrtime ( ) [ 0 ] } ) ;
138138 api . users . check ( { email : req . body . email , pw : req . body . password } ) . then ( function ( user ) {
139- if ( process . env . NODE_ENV === 'development'
140- && ghost . config ( ) . hasOwnProperty ( 'useCookieSession' )
141- && ghost . config ( ) . useCookieSession ) {
142- req . session . user = user . id ;
143- res . json ( 200 , { redirect : req . body . redirect ? '/ghost/'
144- + decodeURIComponent ( req . body . redirect ) : '/ghost/' } ) ;
145- } else {
146- req . session . regenerate ( function ( err ) {
147- if ( ! err ) {
148- req . session . user = user . id ;
149- res . json ( 200 , { redirect : req . body . redirect ? '/ghost/'
150- + decodeURIComponent ( req . body . redirect ) : '/ghost/' } ) ;
151- }
152- } ) ;
153- }
139+ req . session . user = user . id ;
140+ res . json ( 200 , { redirect : req . body . redirect ? '/ghost/'
141+ + decodeURIComponent ( req . body . redirect ) : '/ghost/' } ) ;
154142 } , function ( error ) {
155143 res . json ( 401 , { error : error . message } ) ;
156144 } ) ;
@@ -190,23 +178,10 @@ adminControllers = {
190178 password : password
191179 } ) . then ( function ( user ) {
192180 api . settings . edit ( 'email' , email ) . then ( function ( ) {
193- if ( process . env . NODE_ENV === 'development'
194- && ghost . config ( ) . hasOwnProperty ( 'useCookieSession' )
195- && ghost . config ( ) . useCookieSession ) {
196- if ( req . session . user === undefined ) {
197- req . session . user = user . id ;
198- }
199- res . json ( 200 , { redirect : '/ghost/' } ) ;
200- } else {
201- req . session . regenerate ( function ( err ) {
202- if ( ! err ) {
203- if ( req . session . user === undefined ) {
204- req . session . user = user . id ;
205- }
206- res . json ( 200 , { redirect : '/ghost/' } ) ;
207- }
208- } ) ;
181+ if ( req . session . user === undefined ) {
182+ req . session . user = user . id ;
209183 }
184+ res . json ( 200 , { redirect : '/ghost/' } ) ;
210185 } ) ;
211186 } ) . otherwise ( function ( error ) {
212187 res . json ( 401 , { error : error . message } ) ;
@@ -254,13 +229,7 @@ adminControllers = {
254229 } ) . otherwise ( errors . logAndThrowError ) ;
255230 } ,
256231 'logout' : function ( req , res ) {
257- if ( process . env . NODE_ENV === 'development'
258- && ghost . config ( ) . hasOwnProperty ( 'useCookieSession' )
259- && ghost . config ( ) . useCookieSession ) {
260- delete req . session . user ;
261- } else {
262- req . session . destroy ( ) ;
263- }
232+ req . session = null ;
264233 var notification = {
265234 type : 'success' ,
266235 message : 'You were successfully signed out' ,
@@ -400,13 +369,7 @@ adminControllers = {
400369 } ;
401370
402371 return api . notifications . add ( notification ) . then ( function ( ) {
403- if ( process . env . NODE_ENV === 'development'
404- && ghost . config ( ) . hasOwnProperty ( 'useCookieSession' )
405- && ghost . config ( ) . useCookieSession ) {
406- delete req . session . user ;
407- } else {
408- req . session . destroy ( ) ;
409- }
372+ req . session = null ;
410373 res . set ( {
411374 "X-Cache-Invalidate" : "/*"
412375 } ) ;
0 commit comments