Tokens that are the same as a pages route are no longer allowed

This commit is contained in:
xemeds
2020-08-21 18:05:30 +03:00
parent ce9b0e80a1
commit 1ef3c1b154
+5
View File
@@ -47,6 +47,11 @@ def validate_token(form, field):
if len(field.data) < 6 or len(field.data) > 16: if len(field.data) < 6 or len(field.data) > 16:
return return
# If the token is the same as a pages route
if field.data == "donate" or field.data == "tracker" or field.data == "lookup":
# Raise a ValidationError
raise ValidationError("Token already exists")
# For each character in the token # For each character in the token
for char in field.data: for char in field.data:
# If it is not a valid character # If it is not a valid character