Преглед на файлове

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

Son NK преди 5 години
родител
ревизия
103418dff7
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      app/dashboard/views/custom_domain.py

+ 7 - 0
app/dashboard/views/custom_domain.py

@@ -33,6 +33,13 @@ def custom_domain():
 
 
             if new_custom_domain_form.validate():
             if new_custom_domain_form.validate():
                 new_domain = new_custom_domain_form.domain.data.lower().strip()
                 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):
                 if CustomDomain.get_by(domain=new_domain):
                     flash(f"{new_domain} already added", "warning")
                     flash(f"{new_domain} already added", "warning")
                 elif get_email_domain_part(current_user.email) == new_domain:
                 elif get_email_domain_part(current_user.email) == new_domain: