From 93f9970ca04930b3a8442c03d072c81403baa1e7 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Tue, 7 Nov 2023 23:24:09 +1100 Subject: [PATCH] feat: Add admin bypass ip --- gift.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gift.py b/gift.py index 3389852..f3321da 100644 --- a/gift.py +++ b/gift.py @@ -6,6 +6,7 @@ dotenv.load_dotenv() loaded = False gifts = [] + def gift(name,email,referer, ip): global loaded global gifts @@ -31,11 +32,12 @@ def gift(name,email,referer, ip): loaded = True # Check if the user has already submitted - for gift in gifts: - if gift['email'] == email: - return "You have already submitted a gift request" - if gift['ip'] == ip: - return "You have already submitted a gift request" + if ip != os.getenv('admin_ip'): + for gift in gifts: + if gift['email'] == email: + return "You have already submitted a gift request" + if gift['ip'] == ip: + return "You have already submitted a gift request" # Add the user to the list gifts.append({