1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-08-10 22:31:47 +02:00
2677: Apply DEFAULT_QUOTA to user creation admin ui page r=mergify[bot] a=PMExtra

## What type of PR?

Feature

## What does this PR do?

Apply `DEFAULT_QUOTA` settings to user creation admin ui page.

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [ ] ~In case of feature or enhancement: documentation updated accordingly~
- [ ] ~Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.~

I'm sorry for that I'm not good at English to update the documentation. But this is not a completed new feature. `DEFAULT_QUOTA` is an existing configuration. I just completed the behaviors. Although this configuration was never documented.

Co-authored-by: PM Extra <pm@jubeat.net>
Co-authored-by: Alexander Graf <ghostwheel42@users.noreply.github.com>
This commit is contained in:
bors[bot]
2023-06-28 10:22:18 +00:00
committed by GitHub
2 changed files with 7 additions and 0 deletions

View File

@@ -24,9 +24,12 @@ def user_create(domain_name):
flask.url_for('.user_list', domain_name=domain.name))
form = forms.UserForm()
form.pw.validators = [wtforms.validators.DataRequired()]
form.quota_bytes.default = app.config['DEFAULT_QUOTA']
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")
@@ -44,6 +47,7 @@ def user_create(domain_name):
flask.flash('User %s created' % user)
return flask.redirect(
flask.url_for('.user_list', domain_name=domain.name))
form.process()
return flask.render_template('user/create.html',
domain=domain, form=form)

View File

@@ -134,6 +134,9 @@ the localpart for DMARC rua and ruf email addresses.
Full-text search is enabled for IMAP is enabled by default. This feature can be disabled
(e.g. for performance reasons) by setting the optional variable ``FULL_TEXT_SEARCH`` to ``off``.
You can set a global ``DEFAULT_QUOTA`` to be used for mailboxes when the domain has
no specific quota configured.
.. _web_settings:
Web settings