Преглед изворни кода

Read cookie session length from settings file

James Allen пре 11 година
родитељ
комит
8b4ccae60a

+ 2 - 5
services/web/app/coffee/infrastructure/Server.coffee

@@ -34,9 +34,6 @@ else
 
 app = express()
 
-cookieKey = Settings.cookieName
-cookieSessionLength = 5 * oneDayInMilliseconds
-
 csrf = express.csrf()
 ignoreCsrfRoutes = []
 app.ignoreCsrf = (method, route) ->
@@ -59,10 +56,10 @@ app.configure () ->
 		proxy: Settings.behindProxy
 		cookie:
 			domain: Settings.cookieDomain
-			maxAge: cookieSessionLength
+			maxAge: Settings.cookieSessionLength
 			secure: Settings.secureCookie
 		store: sessionStore
-		key: cookieKey
+		key: Settings.cookieName
 	
 	# Measure expiry from last request, not last login
 	app.use (req, res, next) ->

+ 3 - 0
services/web/config/settings.defaults.coffee

@@ -229,6 +229,9 @@ module.exports =
 	# then set this to true to allow it to correctly detect the forwarded IP
 	# address and http/https protocol information.
 	behindProxy: false
+	
+	# Cookie max age (in milliseconds). Set to false for a browser session.
+	cookieSessionLength: 5 * 24 * 60 * 60 * 1000 # 5 days
 
 	# Internal configs
 	# ----------------