mirror of
https://github.com/Mailu/Mailu.git
synced 2025-05-29 23:07:50 +02:00
Add fields to enable and/or disable pop and imap
This commit is contained in:
parent
49b33aba88
commit
ec0304456b
@ -27,6 +27,8 @@ class UserForm(Form):
|
|||||||
pw = fields.PasswordField('Password', [validators.DataRequired()])
|
pw = fields.PasswordField('Password', [validators.DataRequired()])
|
||||||
pw2 = fields.PasswordField('Confirm password', [validators.EqualTo('pw')])
|
pw2 = fields.PasswordField('Confirm password', [validators.EqualTo('pw')])
|
||||||
quota_bytes = fields_.DecimalSliderField('Quota', default=1000000000)
|
quota_bytes = fields_.DecimalSliderField('Quota', default=1000000000)
|
||||||
|
enable_imap = fields.BooleanField('Allow IMAP access', default=True)
|
||||||
|
enable_pop = fields.BooleanField('Allow POP3 access', default=True)
|
||||||
comment = fields.StringField('Comment')
|
comment = fields.StringField('Comment')
|
||||||
submit = fields.SubmitField('Save')
|
submit = fields.SubmitField('Save')
|
||||||
|
|
||||||
|
@ -83,6 +83,10 @@ class User(Address):
|
|||||||
quota_bytes = db.Column(db.Integer(), nullable=False, default=10**9)
|
quota_bytes = db.Column(db.Integer(), nullable=False, default=10**9)
|
||||||
global_admin = db.Column(db.Boolean(), nullable=False, default=False)
|
global_admin = db.Column(db.Boolean(), nullable=False, default=False)
|
||||||
|
|
||||||
|
# Features
|
||||||
|
enable_imap = db.Column(db.Boolean(), nullable=False, default=True)
|
||||||
|
enable_pop = db.Column(db.Boolean(), nullable=False, default=True)
|
||||||
|
|
||||||
# Filters
|
# Filters
|
||||||
forward = db.Column(db.String(160), nullable=True, default=None)
|
forward = db.Column(db.String(160), nullable=True, default=None)
|
||||||
reply_subject = db.Column(db.String(255), nullable=True, default=None)
|
reply_subject = db.Column(db.String(255), nullable=True, default=None)
|
||||||
|
@ -10,34 +10,42 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro form_field_errors(field) %}
|
||||||
|
{% if field.errors %}
|
||||||
|
{% for error in field.errors %}
|
||||||
|
<p class="help-block inline">{{ error }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro form_fields(fields, prepend='', append='', label=True) %}
|
{% macro form_fields(fields, prepend='', append='', label=True) %}
|
||||||
{% set width = (12 / fields|length)|int %}
|
{% set width = (12 / fields|length)|int %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for field in fields %}
|
{% for field in fields %}
|
||||||
<div class="col-lg-{{ width }} col-xs-12 {{ 'has-error' if field.errors else '' }}">
|
<div class="col-lg-{{ width }} col-xs-12 {{ 'has-error' if field.errors else '' }}">
|
||||||
{{ field.label if label else '' }}
|
{{ form_individual_field(field, prepend=prepend, append=append, label=label, **kwargs) }}
|
||||||
{% if field.errors %}
|
|
||||||
{% for error in field.errors %}
|
|
||||||
<p class="help-block inline">{{ error }}</p>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% if prepend or append %}<div class="input-group">{% endif %}
|
|
||||||
{{ prepend|safe }}
|
|
||||||
{{ field(class_="form-control", **kwargs) }}
|
|
||||||
{{ append|safe }}
|
|
||||||
{% if prepend or append %}</div>{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro form_individual_field(field, prepend='', append='', label=True) %}
|
||||||
|
{% if field.type == "BooleanField" %}
|
||||||
|
{{ field(**kwargs) }}<span> </span>
|
||||||
|
{{ field.label if label else '' }}
|
||||||
|
{% else %}
|
||||||
|
{{ field.label if label else '' }}{{ form_field_errors(field) }}
|
||||||
|
{% if prepend or append %}<div class="input-group">{% endif %}
|
||||||
|
{{ prepend|safe }}{{ field(class_="form-control", **kwargs) }}{{ append|safe }}
|
||||||
|
{% if prepend or append %}</div>{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro form_field(field) %}
|
{% macro form_field(field) %}
|
||||||
{% if field.type == 'SubmitField' %}
|
{% if field.type == 'SubmitField' %}
|
||||||
{{ form_fields((field,), label=False, class="btn btn-default", **kwargs) }}
|
{{ form_fields((field,), label=False, class="btn btn-default", **kwargs) }}
|
||||||
{% elif field.type == 'HiddenField' %}
|
|
||||||
{{ form_fields((field,), label=False, **kwargs) }}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ form_fields((field,), **kwargs) }}
|
{{ form_fields((field,), **kwargs) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -16,6 +16,8 @@ New user
|
|||||||
{{ macros.form_field(form.quota_bytes, step=1000000000, max=50000000000,
|
{{ macros.form_field(form.quota_bytes, step=1000000000, max=50000000000,
|
||||||
prepend='<span class="input-group-addon"><span id="quota">'+(form.quota_bytes.data//1000000000).__str__()+'</span> GiB</span>',
|
prepend='<span class="input-group-addon"><span id="quota">'+(form.quota_bytes.data//1000000000).__str__()+'</span> GiB</span>',
|
||||||
oninput='$("#quota").text(this.value/1000000000);') }}
|
oninput='$("#quota").text(this.value/1000000000);') }}
|
||||||
|
{{ macros.form_field(form.enable_imap) }}
|
||||||
|
{{ macros.form_field(form.enable_pop) }}
|
||||||
{{ macros.form_field(form.comment) }}
|
{{ macros.form_field(form.comment) }}
|
||||||
{{ macros.form_field(form.submit) }}
|
{{ macros.form_field(form.submit) }}
|
||||||
</form>
|
</form>
|
||||||
|
@ -18,9 +18,7 @@ User list
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
<th>Address</th>
|
<th>Address</th>
|
||||||
<th>Name</th>
|
<th>Features</th>
|
||||||
<th>Forward</th>
|
|
||||||
<th>Reply</th>
|
|
||||||
<th>Quota</th>
|
<th>Quota</th>
|
||||||
<th>Comment</th>
|
<th>Comment</th>
|
||||||
<th>Created</th>
|
<th>Created</th>
|
||||||
@ -38,11 +36,12 @@ User list
|
|||||||
<a href="{{ url_for('.user_delete', user_email=user.get_id()) }}" title="Delete"><i class="fa fa-trash"></i></a>
|
<a href="{{ url_for('.user_delete', user_email=user.get_id()) }}" title="Delete"><i class="fa fa-trash"></i></a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ user }}</td>
|
<td>{{ user }}</td>
|
||||||
<td>{{ user.displayed_name }}</td>
|
<td>
|
||||||
<td>{% if user.forward %}<span class="label label-info">enabled</span>{% endif %}</td>
|
{% if user.enable_imap %}<span class="label label-info">imap</span>{% endif %}
|
||||||
<td>{% if user.reply_subject %}<span class="label label-info">enabled</span>{% endif %}</td>
|
{% if user.enable_pop %}<span class="label label-info">pop3</span>{% endif %}
|
||||||
|
</td>
|
||||||
<td>{{ user.quota_bytes | filesizeformat }}</td>
|
<td>{{ user.quota_bytes | filesizeformat }}</td>
|
||||||
<td>{{ user.comment or '' }}</td>
|
<td>{{ user.comment or '-' }}</td>
|
||||||
<td>{{ user.created_at }}</td>
|
<td>{{ user.created_at }}</td>
|
||||||
<td>{{ user.updated_at or '' }}</td>
|
<td>{{ user.updated_at or '' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user