Handle alias to sender-only address

This commit is contained in:
Spitap
2023-07-21 11:34:14 +02:00
parent 3733998f58
commit c05b4a7d26
4 changed files with 25 additions and 10 deletions
@@ -81,7 +81,6 @@ export default {
return await this.$refs.observer.validate() && await this.$refs.passwordForm.validate()
},
update () {
console.log(this.form)
this.$emit('input', this.form)
}
},
@@ -39,6 +39,18 @@
@input="update"
/>
</validation-provider>
<validation-provider
v-slot="{ errors }"
rules=""
>
<v-switch
v-model="form.mailbox.is_send_only"
:label="'Send only account' | translate"
dense
:error-messages="errors"
@input="update"
/>
</validation-provider>
</validation-observer>
</template>
+1
View File
@@ -393,6 +393,7 @@ class MailboxSerializer(serializers.ModelSerializer):
model = models.Mailbox
fields = (
"pk", "use_domain_quota", "quota", "message_limit",
"is_send_only",
)
def validate_quota(self, value):
+12 -9
View File
@@ -99,23 +99,26 @@ class SendOnlyAccountMap(object):
filename = "sql-send-only.cf"
mysql = (
"SELECT '550 Requested mail action not taken: mailbox disabled' "
"FROM admin_mailbox mb INNER JOIN admin_domain dom "
"ON mb.domain_id=dom.id "
"WHERE mb.is_send_only=1 AND dom.name='%d' AND mb.address='%u' "
"FROM modoboa_admin_aliasrecipient amb "
"INNER JOIN admin_mailbox mb "
"ON mb.id=amb.r_mailbox_id "
"WHERE mb.is_send_only=1 AND amb.address=CONCAT('%u', '@','%d') "
"LIMIT 1"
)
postgres = (
"SELECT '550 Requested mail action not taken: mailbox disabled' "
"FROM admin_mailbox mb INNER JOIN admin_domain dom "
"ON mb.domain_id=dom.id "
"WHERE mb.is_send_only AND dom.name='%d' AND mb.address='%u' "
"FROM modoboa_admin_aliasrecipient amb "
"INNER JOIN admin_mailbox mb "
"ON mb.id=amb.r_mailbox_id "
"WHERE mb.is_send_only AND amb.address='%u' || '@' || '%d' "
"LIMIT 1"
)
sqlite = (
"SELECT '550 Requested mail action not taken: mailbox disabled' "
"FROM admin_mailbox mb INNER JOIN admin_domain dom "
"ON mb.domain_id=dom.id "
"WHERE mb.is_send_only=1 AND dom.name='%d' AND mb.address='%u' "
"FROM modoboa_admin_aliasrecipient amb "
"INNER JOIN admin_mailbox mb "
"ON mb.id=amb.r_mailbox_id "
"WHERE mb.is_send_only=1 AND mb.address='%u' || '@' || '%d' "
"LIMIT 1"
)