mirror of
				https://github.com/optim-enterprises-bv/Mailu.git
				synced 2025-10-31 10:08:02 +00:00 
			
		
		
		
	doh
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| from wtforms import validators, fields, widgets | ||||
| from wtforms.validators import ValidationError | ||||
| from wtforms_components import fields as fields_ | ||||
| from flask_babel import lazy_gettext as _ | ||||
|  | ||||
| @@ -9,8 +10,8 @@ import ipaddress | ||||
|  | ||||
| LOCALPART_REGEX = r'^[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+)*$' | ||||
|  | ||||
| def checkStrippable(data): | ||||
|     if data.startswith(' ') or data.endswith(' '): | ||||
| def checkStrippable(form, field): | ||||
|     if field.data.startswith(' ') or field.data.endswith(' '): | ||||
|         raise ValidationError(_('Passwords should not start or end with whitespaces')) | ||||
|  | ||||
| class DestinationField(fields.SelectMultipleField): | ||||
| @@ -93,8 +94,8 @@ class RelayForm(flask_wtf.FlaskForm): | ||||
|  | ||||
| class UserForm(flask_wtf.FlaskForm): | ||||
|     localpart = fields.StringField(_('E-mail'), [validators.DataRequired(), validators.Regexp(LOCALPART_REGEX)]) | ||||
|     pw = fields.PasswordField(_('Password'), [checkStrippable]) | ||||
|     pw2 = fields.PasswordField(_('Confirm password'), [validators.EqualTo('pw')]) | ||||
|     pw = fields.PasswordField(_('Password')) | ||||
|     pw2 = fields.PasswordField(_('Confirm password'), [checkStrippable, validators.EqualTo('pw')]) | ||||
|     pwned = fields.HiddenField(label='', default=-1) | ||||
|     quota_bytes = fields_.IntegerSliderField(_('Quota'), default=10**9) | ||||
|     enable_imap = fields.BooleanField(_('Allow IMAP access'), default=True) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Florent Daigniere
					Florent Daigniere