mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Updated sendonly forms
This commit is contained in:
@@ -107,6 +107,11 @@ export default {
|
||||
{
|
||||
key: this.$gettext('Message sending limit'),
|
||||
value: this.account.mailbox.message_limit
|
||||
},
|
||||
{
|
||||
key: this.$gettext('Send only account'),
|
||||
value: this.account.mailbox.is_send_only,
|
||||
type: 'yesno'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -88,6 +88,11 @@
|
||||
<v-col cols="6" v-else>
|
||||
<translate class="mr-2">Quota: </translate> {{ account.mailbox.quota }}
|
||||
</v-col>
|
||||
<v-col cols="6">
|
||||
<translate class="mr-2">Send only</translate>
|
||||
<v-icon color="success" v-if="account.mailbox.is_send_only">mdi-check-circle-outline</v-icon>
|
||||
<v-icon v-else>mdi-close-circle-outline</v-icon>
|
||||
</v-col>
|
||||
</template>
|
||||
</v-row>
|
||||
</v-fade-transition>
|
||||
|
||||
@@ -156,7 +156,7 @@ class MailboxSerializer(serializers.ModelSerializer):
|
||||
model = models.Mailbox
|
||||
fields = (
|
||||
"pk", "full_address", "use_domain_quota", "quota", "message_limit",
|
||||
"quota_usage"
|
||||
"quota_usage", "is_send_only"
|
||||
)
|
||||
|
||||
def get_quota_usage(self, mb) -> int:
|
||||
|
||||
@@ -249,6 +249,11 @@ class AccountFormMail(forms.Form, DynamicForm):
|
||||
help_text=gettext_lazy(
|
||||
"Number of messages this mailbox can send per day")
|
||||
)
|
||||
is_send_only = forms.BooleanField(
|
||||
required=False,
|
||||
help_text=gettext_lazy(
|
||||
"Block IMAP connection and incoming mails for this mailbox")
|
||||
)
|
||||
aliases = lib_fields.UTF8AndEmptyUserEmailField(
|
||||
label=gettext_lazy("Alias(es)"),
|
||||
required=False,
|
||||
@@ -296,6 +301,7 @@ class AccountFormMail(forms.Form, DynamicForm):
|
||||
self.fields["quota"].initial = self.mb.quota
|
||||
if self.mb.message_limit:
|
||||
self.fields["message_limit"].initial = self.mb.message_limit
|
||||
self.fields["is_send_only"].initial = self.mb.is_send_only
|
||||
self.fields["create_alias_with_old_address"].initial = (
|
||||
params["create_alias_on_mbox_rename"]
|
||||
)
|
||||
@@ -384,7 +390,8 @@ class AccountFormMail(forms.Form, DynamicForm):
|
||||
self.mb = models.Mailbox(
|
||||
address=self.locpart, domain=self.domain, user=account,
|
||||
use_domain_quota=self.cleaned_data["quota_act"],
|
||||
message_limit=self.cleaned_data.get("message_limit")
|
||||
message_limit=self.cleaned_data.get("message_limit"),
|
||||
is_send_only=self.cleaned_data.get("is_send_only", False)
|
||||
)
|
||||
override_rules = (
|
||||
user.is_superuser or
|
||||
|
||||
@@ -326,6 +326,8 @@ class Mailbox(mixins.MessageLimitMixin, AdminObject):
|
||||
self.set_quota(values["quota"], override_rules)
|
||||
if "message_limit" in values:
|
||||
self.message_limit = values["message_limit"]
|
||||
if "is_send_only" in values:
|
||||
self.is_send_only = values["is_send_only"]
|
||||
if newaddress:
|
||||
self.rename(local_part, domain)
|
||||
self.save()
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
{% endif %}
|
||||
{% include "common/generic_field.html" with field=form.quota help_display_mode="tooltip" label_width="col-sm-4" activator=True activator_value=form.quota_act.value deactivate_if_empty=False activator_label=_("Use domain default value") activator_size="col-sm-5" %}
|
||||
{% render_field form.message_limit %}
|
||||
{% render_field form.is_send_only %}
|
||||
{% render_fields_group form "aliases" %}
|
||||
{% render_fields_group form "senderaddress" %}
|
||||
|
||||
Reference in New Issue
Block a user