mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Make sessions more permanent for discord logins
This commit is contained in:
parent
87d47a9c18
commit
3af5dc703a
@ -8,6 +8,7 @@ import os
|
|||||||
from titanembeds.database import get_administrators_list
|
from titanembeds.database import get_administrators_list
|
||||||
from titanembeds.i18n import LANGUAGES
|
from titanembeds.i18n import LANGUAGES
|
||||||
import titanembeds.constants as constants
|
import titanembeds.constants as constants
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import uwsgi
|
import uwsgi
|
||||||
@ -29,6 +30,7 @@ app.config['RATELIMIT_HEADERS_ENABLED'] = True
|
|||||||
app.config['SQLALCHEMY_POOL_RECYCLE'] = 250
|
app.config['SQLALCHEMY_POOL_RECYCLE'] = 250
|
||||||
app.config['SQLALCHEMY_POOL_SIZE'] = 100
|
app.config['SQLALCHEMY_POOL_SIZE'] = 100
|
||||||
app.config['RATELIMIT_STORAGE_URL'] = 'keyvalprops://'
|
app.config['RATELIMIT_STORAGE_URL'] = 'keyvalprops://'
|
||||||
|
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=3)
|
||||||
app.secret_key = config['app-secret']
|
app.secret_key = config['app-secret']
|
||||||
|
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
@ -315,6 +315,7 @@ def create_unauthenticated_user():
|
|||||||
session['user_keys'] = {guild_id: key}
|
session['user_keys'] = {guild_id: key}
|
||||||
else:
|
else:
|
||||||
session['user_keys'][guild_id] = key
|
session['user_keys'][guild_id] = key
|
||||||
|
session.permanent = False
|
||||||
status = update_user_status(guild_id, username, key)
|
status = update_user_status(guild_id, username, key)
|
||||||
return jsonify(status=status)
|
return jsonify(status=status)
|
||||||
else:
|
else:
|
||||||
|
@ -39,6 +39,7 @@ def callback():
|
|||||||
return redirect(url_for('user.logout'))
|
return redirect(url_for('user.logout'))
|
||||||
session['user_keys'] = discord_token
|
session['user_keys'] = discord_token
|
||||||
session['unauthenticated'] = False
|
session['unauthenticated'] = False
|
||||||
|
session.permanent = True
|
||||||
user = get_current_authenticated_user()
|
user = get_current_authenticated_user()
|
||||||
session['user_id'] = user['id']
|
session['user_id'] = user['id']
|
||||||
session['username'] = user['username']
|
session['username'] = user['username']
|
||||||
|
Loading…
Reference in New Issue
Block a user