beaker icon indicating copy to clipboard operation
beaker copied to clipboard

Support modifying session's cookie_expires attribute on runtime.

Open toaco opened this issue 7 years ago • 0 comments

With this feature, we can easy expire session due to inactivity of a user.

For example, if we want to expire the cookie when the browser has not requested any page in 5 minutes, we can do this:

# Flask
@app.after_request
def per_request_callbacks(response):
    session = request.environ['beaker.session']
    session.cookie_expires = 300
    return response

toaco avatar Aug 03 '17 07:08 toaco