diff --git a/events/loginEvent.py b/events/loginEvent.py index 6f36cfd..6069526 100644 --- a/events/loginEvent.py +++ b/events/loginEvent.py @@ -51,6 +51,9 @@ def handle(flaskRequest): # Banned raise exceptions.loginBannedException() + # Log user IP + userHelper.IPLog(userID, requestIP) + # No login errors! # Delete old tokens for that user and generate a new one glob.tokens.deleteOldTokens(userID) diff --git a/helpers/userHelper.py b/helpers/userHelper.py index e574231..e48ea38 100644 --- a/helpers/userHelper.py +++ b/helpers/userHelper.py @@ -297,3 +297,11 @@ def getShowCountry(userID): if country == None: return False return generalFunctions.stringToBool(country) + +def IPLog(userID, ip): + """ + Botnet the user + (log his ip for multiaccount detection) + """ + glob.db.execute("""INSERT INTO ip_user (userid, ip, occurencies) VALUES (?, ?, '1') + ON DUPLICATE KEY UPDATE occurencies = occurencies + 1""", [userID, ip])