Parcourir la source

set max length for domain

Son NK il y a 5 ans
Parent
commit
3eb904c882

+ 1 - 1
app/dashboard/templates/dashboard/custom_domain.html

@@ -66,7 +66,7 @@
 
         <h2 class="h4">New Domain</h2>
 
-        {{ new_custom_domain_form.domain(class="form-control", placeholder="my-domain.com") }}
+        {{ new_custom_domain_form.domain(class="form-control", placeholder="my-domain.com", maxlength=128) }}
         {{ render_field_errors(new_custom_domain_form.domain) }}
         <div class="small-text">Please use full path domain, for ex <em>my-subdomain.my-domain.com</em></div>
 

+ 3 - 2
app/dashboard/views/custom_domain.py

@@ -10,9 +10,10 @@ from app.extensions import db
 from app.models import CustomDomain
 
 
-# todo: add more validation
 class NewCustomDomainForm(FlaskForm):
-    domain = StringField("domain", validators=[validators.DataRequired()])
+    domain = StringField(
+        "domain", validators=[validators.DataRequired(), validators.Length(max=128)]
+    )
 
 
 @dashboard_bp.route("/custom_domain", methods=["GET", "POST"])