diff --git a/core/admin/mailu/ui/forms.py b/core/admin/mailu/ui/forms.py index 80d73fbe..22dbb351 100644 --- a/core/admin/mailu/ui/forms.py +++ b/core/admin/mailu/ui/forms.py @@ -87,6 +87,11 @@ class UserSettingsForm(flask_wtf.FlaskForm): displayed_name = fields.StringField(_('Displayed name')) spam_enabled = fields.BooleanField(_('Enable spam filter')) spam_threshold = fields_.IntegerSliderField(_('Spam filter tolerance')) + forward_enabled = fields.BooleanField(_('Enable forwarding')) + forward_keep = fields.BooleanField(_('Keep a copy of the emails')) + forward_destination = fields.StringField( + _('Destination'), [validators.Optional(), validators.Email()] + ) submit = fields.SubmitField(_('Save settings')) @@ -96,15 +101,6 @@ class UserPasswordForm(flask_wtf.FlaskForm): submit = fields.SubmitField(_('Update password')) -class UserForwardForm(flask_wtf.FlaskForm): - forward_enabled = fields.BooleanField(_('Enable forwarding')) - forward_keep = fields.BooleanField(_('Keep a copy of the emails')) - forward_destination = fields.StringField( - _('Destination'), [validators.Optional(), validators.Email()] - ) - submit = fields.SubmitField(_('Update')) - - class UserReplyForm(flask_wtf.FlaskForm): reply_enabled = fields.BooleanField(_('Enable automatic reply')) reply_subject = fields.StringField(_('Reply subject')) diff --git a/core/admin/mailu/ui/templates/sidebar.html b/core/admin/mailu/ui/templates/sidebar.html index d107c15f..db80d328 100644 --- a/core/admin/mailu/ui/templates/sidebar.html +++ b/core/admin/mailu/ui/templates/sidebar.html @@ -16,11 +16,6 @@ {% trans %}Update password{% endtrans %} -
  • - - {% trans %}Auto-forward{% endtrans %} - -
  • {% trans %}Auto-reply{% endtrans %} diff --git a/core/admin/mailu/ui/templates/user/settings.html b/core/admin/mailu/ui/templates/user/settings.html index dfaff9d6..e14d2d70 100644 --- a/core/admin/mailu/ui/templates/user/settings.html +++ b/core/admin/mailu/ui/templates/user/settings.html @@ -11,9 +11,6 @@ {% block content %}
    {{ form.hidden_tag() }} - {% call macros.box(title=_("General settings")) %} - {{ macros.form_field(form.displayed_name) }} - {% endcall %} {% call macros.box(title=_("Antispam")) %} {{ macros.form_field(form.spam_enabled) }} @@ -21,6 +18,17 @@ prepend=''+form.spam_threshold.data.__str__()+' / 100', oninput='$("#threshold").text(this.value);') }} {% endcall %} + + {% call macros.box(title=_("Auto-forward")) %} + {{ macros.form_field(form.forward_enabled, + onchange="if(this.checked){$('#forward_destination,#forward_keep').removeAttr('disabled')} + else{$('#forward_destination,#forward_keep').attr('disabled', '')}") }} + {{ macros.form_field(form.forward_keep, + **{("enabled" if user.forward_enabled else "disabled"): ""}) }} + {{ macros.form_field(form.forward_destination, + **{("enabled" if user.forward_enabled else "disabled"): ""}) }} + {% endcall %} + {{ macros.form_field(form.submit) }}
    {% endblock %}