summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarian Sigler <m@qjym.de>2012-09-29 17:53:58 +0200
committerMarian Sigler <m@qjym.de>2012-09-29 17:53:58 +0200
commit0afa6b651dfb326481d8b0d0fd5d599384889170 (patch)
treee86498a486adfb2c4dfe65fda6367028b8997423
parentc635b2797c17669fb978ec8e4fa6d5cc6f191488 (diff)
downloadweb-0afa6b651dfb326481d8b0d0fd5d599384889170.tar.gz
web-0afa6b651dfb326481d8b0d0fd5d599384889170.tar.bz2
web-0afa6b651dfb326481d8b0d0fd5d599384889170.zip
Make session last for 10 min; Remove SERVER_NAME from config.
SERVER_NAME just caused problems with cookies and stuff when on localhost.
-rw-r--r--app.py6
-rw-r--r--default_settings.py6
2 files changed, 11 insertions, 1 deletions
diff --git a/app.py b/app.py
index 56731a4..eae781f 100644
--- a/app.py
+++ b/app.py
@@ -18,6 +18,12 @@ if 'SPLINE_ACCOUNT_WEB_SETTINGS' in os.environ:
app.all_services = account.SERVICES #TODO: take that from our json file or so
+@app.before_request
+def session_permanent():
+ if app.config.get('PERMANENT_SESSION_LIFETIME'):
+ session.permanent = True
+ else:
+ session.permanent = False
@app.before_request
def ldap_connect():
diff --git a/default_settings.py b/default_settings.py
index e9ae578..e185717 100644
--- a/default_settings.py
+++ b/default_settings.py
@@ -1,3 +1,6 @@
+from datetime import timedelta
+
+
SECRET_KEY = 'remember to change this to something more random and secret'
# CHANGE THIS! (e.g. os.urandom(32) )
@@ -8,7 +11,8 @@ MAIL_CONFIRM_SENDER = 'spline accounts <noreply@account.spline.de>'
SENDMAIL_COMMAND = '/usr/sbin/sendmail'
-SERVER_NAME = 'localhost:5000'
+# to make the cookie a session cookie, set this to None
+PERMANENT_SESSION_LIFETIME = timedelta(seconds=600) # 10 minutes
LDAP_HOST = 'ldap://localhost:5678'
LDAP_BASE_DN = [('dc','account'),('dc','spline'),('dc','inf'),('dc','fu-berlin'),('dc','de')]