mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 17:26:26 +01:00
Add MAX_AGE config parameter
This commit is contained in:
parent
acaa8367d6
commit
d54419fd35
@ -16,3 +16,6 @@ DISABLE_REGISTER=False
|
|||||||
|
|
||||||
# Front URL of the application (for QRCodes generation)
|
# Front URL of the application (for QRCodes generation)
|
||||||
BASE_URL="http://localhost:5000"
|
BASE_URL="http://localhost:5000"
|
||||||
|
|
||||||
|
# Session expiration, in days
|
||||||
|
MAX_AGE=31
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
Main file
|
Main file
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import datetime
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from flask import Flask, g, redirect, render_template, request, send_file, flash, session, abort
|
from flask import Flask, g, redirect, render_template, request, send_file, flash, session, abort
|
||||||
@ -105,6 +106,12 @@ def search_thumbnail(uuid):
|
|||||||
return send_file(os.path.join(app.static_folder, "search-thumbnails", f"{uuid}.jpg"))
|
return send_file(os.path.join(app.static_folder, "search-thumbnails", f"{uuid}.jpg"))
|
||||||
|
|
||||||
|
|
||||||
|
@app.before_request
|
||||||
|
def before_request():
|
||||||
|
"""Set cookie max age to 31 days"""
|
||||||
|
session.permanent = True
|
||||||
|
app.permanent_session_lifetime = datetime.timedelta(days=int(app.config["MAX_AGE"]))
|
||||||
|
|
||||||
@app.context_processor
|
@app.context_processor
|
||||||
def inject_default_variables():
|
def inject_default_variables():
|
||||||
"""Inject the version number in the template variables"""
|
"""Inject the version number in the template variables"""
|
||||||
|
Loading…
Reference in New Issue
Block a user