Added a custom message for invalid URLs that contain the websites domain

This commit is contained in:
xemeds
2020-08-17 09:59:57 +03:00
parent 00f1ca051f
commit 143e992ede
+1 -1
View File
@@ -32,7 +32,7 @@ def validate_URL(form, field):
# If the url contains the websites domain # If the url contains the websites domain
if WEBSITE_DOMAIN in field.data.lower(): if WEBSITE_DOMAIN in field.data.lower():
# Raise a ValidationError # Raise a ValidationError
raise ValidationError("Invalid URL") raise ValidationError("Yeah, that's definitely a valid URL")
# If the URL does not start with http:// and https:// # If the URL does not start with http:// and https://
if not(field.data.lower().startswith("http://")) and not(field.data.lower().startswith("https://")): if not(field.data.lower().startswith("http://")) and not(field.data.lower().startswith("https://")):