flask session auto logout in 5 mins

Solutions on MaxInterview for flask session auto logout in 5 mins by the best coders in the world

showing results for - "flask session auto logout in 5 mins"
Elias
16 Sep 2016
1from datetime import timedelta
2 app = Flask(__name__)
3 app.config['SECRET_KEY'] = 'xxxxxxxxx'
4 app.config['PERMANENT_SESSION_LIFETIME'] =  timedelta(minutes=5)
5The session will created for each client, seperated from other clients. So, I think the best place to set session.permanent is when you login():
6
7@app.route('/login', methods=['GET', 'POST'])
8def login():
9    #After Verify the validity of username and password
10    session.permanent = True