mirror of
				https://github.com/optim-enterprises-bv/Mailu.git
				synced 2025-10-31 10:08:02 +00:00 
			
		
		
		
	Add input validation for domain creation
This commit is contained in:
		| @@ -18,6 +18,7 @@ def domain_list(): | ||||
| def domain_create(): | ||||
|     form = forms.DomainForm() | ||||
|     if form.validate_on_submit(): | ||||
|         if validators.domain(form.name.data) is True: | ||||
|             conflicting_domain = models.Domain.query.get(form.name.data) | ||||
|             conflicting_alternative = models.Alternative.query.get(form.name.data) | ||||
|             conflicting_relay = models.Relay.query.get(form.name.data) | ||||
| @@ -29,6 +30,8 @@ def domain_create(): | ||||
|                 models.db.session.add(domain) | ||||
|                 models.db.session.commit() | ||||
|                 flask.flash('Domain %s created' % domain) | ||||
|         else: | ||||
|             flask.flash('Domain %s is invalid' % form.name.data, 'error') | ||||
|         return flask.redirect(flask.url_for('.domain_list')) | ||||
|     return flask.render_template('domain/create.html', form=form) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kevin Falcoz
					Kevin Falcoz