mirror of
https://github.com/Mailu/Mailu.git
synced 2025-02-19 19:10:25 +02:00
Handle infinite quotas when adding validators, fixes #162
(cherry picked from commit fe0b292d452c0b54386c169899ffec4517becb7d)
This commit is contained in:
parent
2bd2fb456b
commit
c1d175d7a7
@ -22,8 +22,9 @@ def user_create(domain_name):
|
||||
return flask.redirect(
|
||||
flask.url_for('.user_list', domain_name=domain.name))
|
||||
form = forms.UserForm()
|
||||
form.quota_bytes.validators = [
|
||||
wtforms.validators.NumberRange(max=domain.max_quota_bytes)]
|
||||
if domain.max_quota_bytes:
|
||||
form.quota_bytes.validators = [
|
||||
wtforms.validators.NumberRange(max=domain.max_quota_bytes)]
|
||||
if form.validate_on_submit():
|
||||
if domain.has_email(form.localpart.data):
|
||||
flask.flash('Email is already used', 'error')
|
||||
@ -53,8 +54,9 @@ def user_edit(user_email):
|
||||
wtforms_components.read_only(form.localpart)
|
||||
form.pw.validators = []
|
||||
form.localpart.validators = []
|
||||
form.quota_bytes.validators = [
|
||||
wtforms.validators.NumberRange(max=max_quota_bytes)]
|
||||
if max_quota_bytes:
|
||||
form.quota_bytes.validators = [
|
||||
wtforms.validators.NumberRange(max=max_quota_bytes)]
|
||||
if form.validate_on_submit():
|
||||
form.populate_obj(user)
|
||||
if form.pw.data:
|
||||
|
Loading…
x
Reference in New Issue
Block a user