diff --git a/files/routes/routehelpers.py b/files/routes/routehelpers.py index bca65652c..d4b7cd014 100644 --- a/files/routes/routehelpers.py +++ b/files/routes/routehelpers.py @@ -13,6 +13,10 @@ from files.helpers.config.const import * from files.helpers.security import generate_hash, validate_hash from files.__main__ import cache +if FEATURES['IP_LOGGING']: + from files.classes import IPLog + from files.__main__ import get_IP + def check_session_id(): if not session.get("session_id"): session.permanent = True @@ -84,6 +88,15 @@ def check_for_alts(current, include_current_session=False): ).all()] past_accs.update(more_ids) + if FEATURES['IP_LOGGING']: + one_day_ago = time.time() - 86400 + more_ids = [x[0] for x in g.db.query(IPLog.user_id).filter( + IPLog.ip == get_IP(), + IPLog.user_id != current.id, + IPLog.last_used > one_day_ago, + ).all()] + past_accs.update(more_ids) + for past_id in list(past_accs): if past_id == current.id: continue