Tuesday, 15 July 2014

python - How do I only enable cookies if the user logs in? -



python - How do I only enable cookies if the user logs in? -

i have flask app runs on https behind nginx. app uses flask-login log users in.

i have set app.secret_key , have 3 views:

@app.route('/') def index(): homecoming render_template('index.html') @app.route('/login', methods=['get', 'post']) def login(): form = login() if form.validate_on_submit(): # log user in... ...... homecoming redirect(request.args.get('next') or '/') homecoming render_template('login.html', form=form) @login_required @app.route('/logged_in') def logged_in(): homecoming render_template('logged_in.html')

the vast, vast bulk of users not log in (and don't have user account) , complaining setting cookies on them. can confirm behavior in browser (firefox) when delete cookie, visit "https://www.example.com" , see cookie gets reset.

how alter behavior cookie gets reset if user logs in?

python cookies flask

No comments:

Post a Comment