As proposed in issue #354; it adds an attribute max_age
to mediagoblin.tools.session.Session that is passed to
response.set_cookie; max_age is set to 30 days if the
checkbox is selected
if user:
# set up login in session
+ if login_form.stay_logged_in.data:
+ request.session.max_age = 30 * 24 * 60 * 60
request.session['user_id'] = unicode(user.id)
request.session.save()
normalize_user_or_email_field()])
password = wtforms.PasswordField(
_('Password'))
+ stay_logged_in = wtforms.BooleanField(
+ _('Stay logged in'))
class Session(dict):
def __init__(self, *args, **kwargs):
self.send_new_cookie = False
+ self.max_age = None
dict.__init__(self, *args, **kwargs)
def save(self):
response.delete_cookie(self.cookie_name)
else:
response.set_cookie(self.cookie_name, self.signer.dumps(session),
- httponly=True)
+ max_age=session.max_age, httponly=True)