mirror of
				https://github.com/optim-enterprises-bv/Mailu-OIDC.git
				synced 2025-11-04 03:58:07 +00:00 
			
		
		
		
	Apply DEFAULT_QUOTA to user creation admin ui page
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
from wtforms import validators, fields, widgets
 | 
			
		||||
from wtforms_components import fields as fields_
 | 
			
		||||
from flask_babel import lazy_gettext as _
 | 
			
		||||
from flask import current_app as app
 | 
			
		||||
 | 
			
		||||
import flask_login
 | 
			
		||||
import flask_wtf
 | 
			
		||||
@@ -91,7 +92,7 @@ class UserForm(flask_wtf.FlaskForm):
 | 
			
		||||
    pw = fields.PasswordField(_('Password'))
 | 
			
		||||
    pw2 = fields.PasswordField(_('Confirm password'), [validators.EqualTo('pw')])
 | 
			
		||||
    pwned = fields.HiddenField(label='', default=-1)
 | 
			
		||||
    quota_bytes = fields_.IntegerSliderField(_('Quota'), default=10**9)
 | 
			
		||||
    quota_bytes = fields_.IntegerSliderField(_('Quota'), default=app.config['DEFAULT_QUOTA'])
 | 
			
		||||
    enable_imap = fields.BooleanField(_('Allow IMAP access'), default=True)
 | 
			
		||||
    enable_pop = fields.BooleanField(_('Allow POP3 access'), default=True)
 | 
			
		||||
    allow_spoofing = fields.BooleanField(_('Allow the user to spoof the sender (send email as anyone)'), default=False)
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,8 @@ def user_create(domain_name):
 | 
			
		||||
    if domain.max_quota_bytes:
 | 
			
		||||
        form.quota_bytes.validators = [
 | 
			
		||||
            wtforms.validators.NumberRange(max=domain.max_quota_bytes)]
 | 
			
		||||
        if form.quota_bytes.default > domain.max_quota_bytes:
 | 
			
		||||
            form.quota_bytes.default = domain.max_quota_bytes
 | 
			
		||||
    if form.validate_on_submit():
 | 
			
		||||
        if msg := utils.isBadOrPwned(form):
 | 
			
		||||
            flask.flash(msg, "error")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user