pyramid_cubicweb/login.py
changeset 11562 a49f08423f02
parent 11537 caf268942436
child 11609 cc1d4b66ca26
--- a/pyramid_cubicweb/login.py	Thu Feb 12 19:21:39 2015 +0100
+++ b/pyramid_cubicweb/login.py	Thu Feb 26 00:56:32 2015 +0100
@@ -2,6 +2,7 @@
 from pyramid import security
 from pyramid.httpexceptions import HTTPSeeOther
 from pyramid.view import view_config
+from pyramid.settings import asbool
 
 import cubicweb
 
@@ -52,10 +53,9 @@
         del request.cw_request.post['__password']
         return login_form(request)
 
-    max_age = None
-    if request.params.get('__setauthcookie') == '1':
-        max_age = 604800
-    headers = security.remember(request, user_eid, max_age=max_age)
+    headers = security.remember(
+        request, user_eid,
+        persistent=asbool(request.params.get('__setauthcookie', False)))
 
     new_path = request.params.get('postlogin_path', '/')