mirror of
https://github.com/schroinerxy/cloud-mail.git
synced 2026-06-21 19:35:50 +08:00
新增站内发送权限
This commit is contained in:
@@ -94,11 +94,10 @@ const en = {
|
|||||||
order: 'Order',
|
order: 'Order',
|
||||||
default: 'Default',
|
default: 'Default',
|
||||||
description: 'Description',
|
description: 'Description',
|
||||||
removeContent: 'Remove content',
|
|
||||||
removeAll: 'Remove all',
|
|
||||||
expand: 'Expand',
|
expand: 'Expand',
|
||||||
collapse: 'Collapse',
|
collapse: 'Collapse',
|
||||||
daily: 'Daily',
|
daily: 'Daily',
|
||||||
|
internal: 'Internal',
|
||||||
searchRegKeyDesc: 'Enter invite code to search',
|
searchRegKeyDesc: 'Enter invite code to search',
|
||||||
remainingUses: 'Remaining Uses',
|
remainingUses: 'Remaining Uses',
|
||||||
exhausted: 'Exhausted',
|
exhausted: 'Exhausted',
|
||||||
|
|||||||
@@ -94,11 +94,10 @@ const zh = {
|
|||||||
order: '排序',
|
order: '排序',
|
||||||
default: '默认',
|
default: '默认',
|
||||||
description: '描述',
|
description: '描述',
|
||||||
removeContent: '移除正文',
|
|
||||||
removeAll: '丢弃邮件',
|
|
||||||
expand: '展开',
|
expand: '展开',
|
||||||
collapse: '收起',
|
collapse: '收起',
|
||||||
daily: '每天',
|
daily: '每天',
|
||||||
|
internal: '站内',
|
||||||
searchRegKeyDesc: '输入注册码搜索',
|
searchRegKeyDesc: '输入注册码搜索',
|
||||||
remainingUses: '剩余次数',
|
remainingUses: '剩余次数',
|
||||||
exhausted: '已用尽',
|
exhausted: '已用尽',
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
<div>{{ formatDetailDate(email.createTime) }}</div>
|
<div>{{ formatDetailDate(email.createTime) }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-alert v-if="email.status === 3" :closable="false" :title="`${$t('bounced')} ` + toMessage(email.message)" class="email-msg" type="error" show-icon />
|
<el-alert v-if="email.status === 3" :closable="false" :title="toMessage(email.message)" class="email-msg" type="error" show-icon />
|
||||||
<el-alert v-if="email.status === 4" :closable="false" :title="$t('complained')" class="email-msg" type="warning" show-icon />
|
<el-alert v-if="email.status === 4" :closable="false" :title="$t('complained')" class="email-msg" type="warning" show-icon />
|
||||||
<el-alert v-if="email.status === 5" :closable="false" :title="$t('delayed')" class="email-msg" type="warning" show-icon />
|
<el-alert v-if="email.status === 5" :closable="false" :title="$t('delayed')" class="email-msg" type="warning" show-icon />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -71,13 +71,8 @@
|
|||||||
autocomplete="off"/>
|
autocomplete="off"/>
|
||||||
<el-input class="dialog-input" v-model="form.description" :maxlength="30" type="text"
|
<el-input class="dialog-input" v-model="form.description" :maxlength="30" type="text"
|
||||||
:placeholder="$t('description')" autocomplete="off"/>
|
:placeholder="$t('description')" autocomplete="off"/>
|
||||||
<el-input-tag class="dialog-input-tag" tag-type="warning"
|
<el-input-tag class="dialog-input" tag-type="warning" v-model="form.banEmail"
|
||||||
:class="form.banEmail.length === 0 ? 'dialog-input' : '' " v-model="form.banEmail"
|
|
||||||
@add-tag="banEmailAddTag" type="text" :placeholder="$t('emailInterception')" autocomplete="off"/>
|
@add-tag="banEmailAddTag" type="text" :placeholder="$t('emailInterception')" autocomplete="off"/>
|
||||||
<el-radio-group class="dialog-radio" v-model="form.banEmailType" v-if="form.banEmail.length > 0">
|
|
||||||
<el-radio :label="$t('removeAll')" :value="0"/>
|
|
||||||
<el-radio :label="$t('removeContent')" :value="1"/>
|
|
||||||
</el-radio-group>
|
|
||||||
<el-select
|
<el-select
|
||||||
class="dialog-input"
|
class="dialog-input"
|
||||||
v-model="form.availDomain"
|
v-model="form.availDomain"
|
||||||
@@ -125,9 +120,10 @@
|
|||||||
:placeholder="$t('total')">
|
:placeholder="$t('total')">
|
||||||
</el-input-number>
|
</el-input-number>
|
||||||
<el-select v-model="form.sendType" placeholder="Select" size="small"
|
<el-select v-model="form.sendType" placeholder="Select" size="small"
|
||||||
style="width: 65px;margin-left: 5px;">
|
:style="`width: ${ locale === 'zh' ? 65 : 85 }px;margin-left: 5px;`">
|
||||||
<el-option :label="$t('total')" value="count"/>
|
<el-option :label="$t('total')" value="count"/>
|
||||||
<el-option :label="$t('daily')" value="day"/>
|
<el-option :label="$t('daily')" value="day"/>
|
||||||
|
<el-option :label="$t('internal')" value="internal"/>
|
||||||
<el-option :label="$t('btnBan')" value="ban"/>
|
<el-option :label="$t('btnBan')" value="ban"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</span>
|
</span>
|
||||||
@@ -186,7 +182,6 @@ const form = reactive({
|
|||||||
name: null,
|
name: null,
|
||||||
description: null,
|
description: null,
|
||||||
banEmail: [],
|
banEmail: [],
|
||||||
banEmailType: 0,
|
|
||||||
sendType: 'count',
|
sendType: 'count',
|
||||||
sendCount: 0,
|
sendCount: 0,
|
||||||
accountCount: 0,
|
accountCount: 0,
|
||||||
@@ -335,7 +330,6 @@ function resetForm() {
|
|||||||
form.sendCount = 0
|
form.sendCount = 0
|
||||||
form.accountCount = 0
|
form.accountCount = 0
|
||||||
form.banEmail = []
|
form.banEmail = []
|
||||||
form.banEmailType = 0
|
|
||||||
form.availDomain = []
|
form.availDomain = []
|
||||||
tree.value.setCheckedKeys([])
|
tree.value.setCheckedKeys([])
|
||||||
}
|
}
|
||||||
@@ -352,7 +346,6 @@ function openRoleSet(role) {
|
|||||||
form.sendCount = role.sendCount
|
form.sendCount = role.sendCount
|
||||||
form.accountCount = role.accountCount
|
form.accountCount = role.accountCount
|
||||||
form.banEmail = role.banEmail
|
form.banEmail = role.banEmail
|
||||||
form.banEmailType = role.banEmailType
|
|
||||||
form.availDomain = role.availDomain
|
form.availDomain = role.availDomain
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
tree.value.setCheckedKeys(role.permIds)
|
tree.value.setCheckedKeys(role.permIds)
|
||||||
@@ -526,14 +519,6 @@ window.onresize = () => {
|
|||||||
.dialog-input {
|
.dialog-input {
|
||||||
margin-bottom: 15px !important;
|
margin-bottom: 15px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-radio {
|
|
||||||
margin-top: 5px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog-input-tag {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.perm-expand {
|
.perm-expand {
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ const en = {
|
|||||||
botVerifyFail: 'Bot verification failed, please try again',
|
botVerifyFail: 'Bot verification failed, please try again',
|
||||||
authExpired: 'Authentication has expired. Please sign in again',
|
authExpired: 'Authentication has expired. Please sign in again',
|
||||||
unauthorized: 'Unauthorized',
|
unauthorized: 'Unauthorized',
|
||||||
bannedSend: 'You do not have permission to send emails',
|
bannedSend: 'You can only send emails to internal mailboxes',
|
||||||
|
onlyInternalSend: 'Your current role allows sending internal emails only',
|
||||||
noDomainPermAdd: "No permission to add this domain email",
|
noDomainPermAdd: "No permission to add this domain email",
|
||||||
noDomainPermReg: "No permission to register this domain email",
|
noDomainPermReg: "No permission to register this domain email",
|
||||||
noDomainPermRegKey: "Registration code not valid for this domain",
|
noDomainPermRegKey: "Registration code not valid for this domain",
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ const zh = {
|
|||||||
botVerifyFail: '人机验证失败,请重试',
|
botVerifyFail: '人机验证失败,请重试',
|
||||||
authExpired: '身份认证失效,请重新登录',
|
authExpired: '身份认证失效,请重新登录',
|
||||||
unauthorized: '权限不足',
|
unauthorized: '权限不足',
|
||||||
bannedSend: '你没有发送邮件权限',
|
bannedSend: '你没有邮件发送权限',
|
||||||
|
onlyInternalSend: '权限不足,只能给站内邮箱发件',
|
||||||
noDomainPermAdd: '你没有权限添加该域名邮箱',
|
noDomainPermAdd: '你没有权限添加该域名邮箱',
|
||||||
noDomainPermReg: '你没有权限注册该域名邮箱',
|
noDomainPermReg: '你没有权限注册该域名邮箱',
|
||||||
noDomainPermRegKey: '你的注册码没有权限注册该域名邮箱',
|
noDomainPermRegKey: '你的注册码没有权限注册该域名邮箱',
|
||||||
|
|||||||
@@ -175,9 +175,24 @@ const emailService = {
|
|||||||
const userRow = await userService.selectById(c, userId);
|
const userRow = await userService.selectById(c, userId);
|
||||||
const roleRow = await roleService.selectById(c, userRow.type);
|
const roleRow = await roleService.selectById(c, userRow.type);
|
||||||
|
|
||||||
//如果不是管理员,发送被禁用
|
//判断接收方是不是全部为站内邮箱
|
||||||
if (c.env.admin !== userRow.email && roleRow.sendType === 'ban') {
|
const allInternal = receiveEmail.every(email => {
|
||||||
throw new BizError(t('bannedSend'), 403);
|
const domain = '@' + emailUtils.getDomain(email);
|
||||||
|
return domainList.includes(domain);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (c.env.admin !== userRow.email) {
|
||||||
|
|
||||||
|
//发件被禁用
|
||||||
|
if (roleRow.sendType === 'ban') {
|
||||||
|
throw new BizError(t('bannedSend'), 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
//发件被禁用
|
||||||
|
if (roleRow.sendType === 'internal' && !allInternal) {
|
||||||
|
throw new BizError(t('onlyInternalSend'), 403);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果不是管理员,权限设置了发送次数
|
//如果不是管理员,权限设置了发送次数
|
||||||
@@ -213,12 +228,6 @@ const emailService = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断接收方是不是全部为站内邮箱
|
|
||||||
const allInternal = receiveEmail.every(email => {
|
|
||||||
const domain = '@' + emailUtils.getDomain(email);
|
|
||||||
return domainList.includes(domain);
|
|
||||||
});
|
|
||||||
|
|
||||||
const domain = emailUtils.getDomain(accountRow.email);
|
const domain = emailUtils.getDomain(accountRow.email);
|
||||||
const resendToken = resendTokens[domain];
|
const resendToken = resendTokens[domain];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user