feat: Add admin bypass ip
All checks were successful
Build Docker / Build Image (push) Successful in 28s

This commit is contained in:
Nathan Woodburn 2023-11-07 23:24:09 +11:00
parent c200839b8e
commit 93f9970ca0
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

12
gift.py
View File

@ -6,6 +6,7 @@ dotenv.load_dotenv()
loaded = False loaded = False
gifts = [] gifts = []
def gift(name,email,referer, ip): def gift(name,email,referer, ip):
global loaded global loaded
global gifts global gifts
@ -31,11 +32,12 @@ def gift(name,email,referer, ip):
loaded = True loaded = True
# Check if the user has already submitted # Check if the user has already submitted
for gift in gifts: if ip != os.getenv('admin_ip'):
if gift['email'] == email: for gift in gifts:
return "You have already submitted a gift request" if gift['email'] == email:
if gift['ip'] == ip: return "You have already submitted a gift request"
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 # Add the user to the list
gifts.append({ gifts.append({