Skip to content

Commit

Permalink
Disable ip search email
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasBottone committed Jul 18, 2024
1 parent c7cbe94 commit 5026adb
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions highscores/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,23 +577,23 @@ def search_for_reused_code(score_obj: Score) -> Union[str, None]:

return 'That clean code has already been submitted by another player.'

# same ip but different player
ip_search = CleanCodeSubmission.objects.filter(
ip=score_obj.ip).exclude(player=score_obj.player)

if ip_search.exists():
# Uh oh, there are multiple users submitting from the same IP.
# Report this via email.

message = f"{score_obj.player} ({score_obj.ip}) submitted a score (successfully): [{score_obj.score}] - {score_obj.leaderboard}\n\n This IP has also been used by {ip_search[0].player} ({ip_search[0].ip})\n\n {score_obj.source}\n\nhttps://secondrobotics.org/admin/highscores/score/"
try:
if (not DEBUG):
send_mail(f"Duplicate IP usage from {score_obj.player}",
message, EMAIL_HOST_USER, ADMIN_EMAILS, fail_silently=False)
except Exception as ex:
print(ex)

# Still allow the score to be submitted.
# # same ip but different player
# ip_search = CleanCodeSubmission.objects.filter(
# ip=score_obj.ip).exclude(player=score_obj.player)

# if ip_search.exists():
# # Uh oh, there are multiple users submitting from the same IP.
# # Report this via email.

# message = f"{score_obj.player} ({score_obj.ip}) submitted a score (successfully): [{score_obj.score}] - {score_obj.leaderboard}\n\n This IP has also been used by {ip_search[0].player} ({ip_search[0].ip})\n\n {score_obj.source}\n\nhttps://secondrobotics.org/admin/highscores/score/"
# try:
# if (not DEBUG):
# send_mail(f"Duplicate IP usage from {score_obj.player}",
# message, EMAIL_HOST_USER, ADMIN_EMAILS, fail_silently=False)
# except Exception as ex:
# print(ex)

# # Still allow the score to be submitted.

return None # No error

Expand Down

0 comments on commit 5026adb

Please sign in to comment.