Strip off http:// or https:// prefix in domain

This commit is contained in:
Son NK 2020-05-05 12:46:32 +02:00
parent 3eb904c882
commit 103418dff7
1 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,13 @@ def custom_domain():
if new_custom_domain_form.validate():
new_domain = new_custom_domain_form.domain.data.lower().strip()
if new_domain.startswith("http://"):
new_domain = new_domain[len("http://") :]
if new_domain.startswith("https://"):
new_domain = new_domain[len("https://") :]
if CustomDomain.get_by(domain=new_domain):
flash(f"{new_domain} already added", "warning")
elif get_email_domain_part(current_user.email) == new_domain: