From 0afa6b651dfb326481d8b0d0fd5d599384889170 Mon Sep 17 00:00:00 2001 From: Marian Sigler Date: Sat, 29 Sep 2012 17:53:58 +0200 Subject: Make session last for 10 min; Remove SERVER_NAME from config. SERVER_NAME just caused problems with cookies and stuff when on localhost. --- app.py | 6 ++++++ default_settings.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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 ' 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')] -- cgit v1.2.3-1-g7c22