From 103418dff7ca2cc600f4c9c60e9ce313c18befaf Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Tue, 5 May 2020 12:46:32 +0200 Subject: [PATCH] Strip off http:// or https:// prefix in domain --- app/dashboard/views/custom_domain.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/dashboard/views/custom_domain.py b/app/dashboard/views/custom_domain.py index 301bab67..b6953c4d 100644 --- a/app/dashboard/views/custom_domain.py +++ b/app/dashboard/views/custom_domain.py @@ -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: