.BANCHO. Log user ip in pep.py on login

This commit is contained in:
Howl authored and Nyo committed 2016-07-31 11:10:14 +02:00
1 parent f8c1f49170
commit 3d57bc5bd2
2 files changed
+11

No files matched your search

+3
View File
@@ -51,6 +51,9 @@ def handle(flaskRequest):
# Banned # Banned
raise exceptions.loginBannedException() raise exceptions.loginBannedException()
# Log user IP
userHelper.IPLog(userID, requestIP)
# No login errors! # No login errors!
# Delete old tokens for that user and generate a new one # Delete old tokens for that user and generate a new one
glob.tokens.deleteOldTokens(userID) glob.tokens.deleteOldTokens(userID)
+8
View File
@@ -297,3 +297,11 @@ def getShowCountry(userID):
if country == None: if country == None:
return False return False
return generalFunctions.stringToBool(country) 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])