configure cookies properly
This commit is contained in:
parent
cf286918f9
commit
f3a37a11d1
1
app.py
1
app.py
|
@ -10,6 +10,7 @@ default_config = {
|
|||
"SQLALCHEMY_DATABASE_URI": "postgresql+psycopg2:///forget",
|
||||
"SECRET_KEY": "hunter2",
|
||||
"CELERY_BROKER": "amqp://",
|
||||
"HTTPS": True
|
||||
}
|
||||
|
||||
app.config.update(default_config)
|
||||
|
|
|
@ -29,6 +29,8 @@ SERVER_NAME="localhost:5000"
|
|||
|
||||
CELERY_BROKER='amqp://'
|
||||
|
||||
HTTPS=True
|
||||
|
||||
"""
|
||||
you can also use any config variable that flask expects here, such as
|
||||
"""
|
||||
|
|
|
@ -48,7 +48,9 @@ def twitter_login_step2():
|
|||
tasks.fetch_acc.s(token.account_id).delay()
|
||||
|
||||
resp = Response(status=301, headers={"location": url_for('index')})
|
||||
resp.set_cookie('forget_sid', session.id)
|
||||
resp.set_cookie('forget_sid', session.id,
|
||||
max_age=60*60*48,
|
||||
secure=app.config.get("HTTPS"))
|
||||
return resp
|
||||
|
||||
@app.route('/logout')
|
||||
|
|
Loading…
Reference in New Issue