补齐邮件协议隔离回归并优化客户端设置
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-09-06 22:28:20 +08:00
1 parent 110a5f86cc
commit 20a6eea3b3
15 files changed
+360 -21

No files matched your search

@@ -116,12 +116,12 @@ const baseGroups = [
]
const smtpGroups = [
group('listener', 'SMTP 服务监听', '', [
group('listener', 'SMTP 服务监听', '本地邮件服务默认启动,不受中继配置或用户协议开关控制。', [
port('listener.port', 'SMTP 收信端口', { min: 1, hint: '默认 25,用于接收其他邮件服务器投递,支持 STARTTLS;不是发信中继端口。' }),
port('listener.starttlsPort', 'SMTP 提交端口(STARTTLS)', { min: 1, hint: '默认 587,客户端升级 TLS 后进行认证。' }),
port('listener.tlsPort', 'SMTP 隐式 TLS 端口', { min: 1, hint: '默认 465,客户端建立连接时直接使用 TLS。' })
]),
group('relay', 'SMTP 中继连接', '用于发送验证及通知邮件。未使用中继时可保留空值。', [
group('relay', 'SMTP 中继连接(可选)', '仅用于验证及通知邮件外发,不负责启动本地邮件服务;未使用时可保留空值。', [
field('relay.relayHost', 'SMTP 服务器', 'text', { placeholder: 'smtp.example.com' }),
field('relay.security', '连接加密', 'select', {
options: options([
@@ -13,7 +13,7 @@ const sections = [
{ value: 'ssl', label: 'SSL 配置', description: '管理证书与加密连接,应用后请留意待重启提示。' },
{ value: 'plugins', label: '插件配置', description: '管理插件运行配置,敏感设置仅显示配置状态。' },
{ value: 'spam_block', label: '垃圾邮件拦截', description: '配置垃圾邮件检测服务、超时和拦截阈值,仅编辑当前插件。' },
{ value: 'telegram_push', label: 'Telegram 推送', description: '配置 Telegram 推送的运行参数与网络权限,个人绑定在第三方授权中管理。' },
{ value: 'telegram_push', label: 'Telegram 推送', description: '配置 Telegram 推送的运行参数与网络权限,个人绑定在扩展功能中管理。' },
{ value: 'wechat_push', label: '微信推送', description: '配置微信推送的应用、模板与接收用户,敏感凭据不回填。' }
]
@@ -44,7 +44,7 @@ export function usePage() {
const settingsMenu = computed(() => [
{ key: 'security', label: lang.security, hint: '账号与登录保护', icon: Lock, component: SecuritySettings, capability: 'password.change_own' },
{ key: 'third-party', label: '第三方授权', hint: '邮件客户端接入', icon: Connection, component: ThirdPartyAuthorization, capability: 'plugin.write_own' },
{ key: 'third-party', label: '邮件客户端', hint: '当前账号协议授权', icon: Connection, component: ThirdPartyAuthorization, capability: 'user.read' },
{ key: 'config', label: '配置管理', hint: '服务与运行配置', icon: Setting, component: ConfigSettings, capability: 'config.read' },
{ key: 'group', label: lang.group_settings, hint: '邮箱分组管理', icon: FolderOpened, component: GroupSettings, capability: 'user.read' },
{ key: 'rule', label: lang.rule_setting, hint: '邮件处理规则', icon: Filter, component: RuleSettings, capability: 'user.read' },
@@ -29,11 +29,11 @@ export function usePage() {
try {
const response = await http.get('/api/v1/security/credentials/protocols')
if (response.errorNo !== 0) {
throw new Error(response.errorMsg || '读取第三方授权设置失败')
throw new Error(response.errorMsg || '读取邮件客户端协议设置失败')
}
protocolCredentials.value = Array.isArray(response.data) ? response.data : []
} catch (error) {
notify(error?.message || '读取第三方授权设置失败')
notify(error?.message || '读取邮件客户端协议设置失败')
} finally {
protocolLoading.value = false
}
@@ -52,7 +52,11 @@ export function usePage() {
if (response.errorNo !== 0) {
throw new Error(response.errorMsg || '协议设置失败')
}
notify(`${protocolLabel(item.protocol)} 协议已${enabled ? '开启' : '关闭'}`, 'success')
if (!enabled && generatedProtocol.value === item.protocol) {
generatedProtocol.value = ''
generatedProtocolCode.value = ''
}
notify(`${protocolLabel(item.protocol)} 当前账号客户端访问已${enabled ? '开启' : '关闭'}`, 'success')
} catch (error) {
item.enabled = previous
notify(error?.message || '协议设置失败')
@@ -2,14 +2,14 @@
<div class="third-party-authorization" v-loading="protocolLoading">
<section class="authorization-section">
<div class="authorization-header">
<h3>第三方邮件客户端登录</h3>
<h3>邮件客户端协议</h3>
<p class="authorization-desc">
开启协议并生成授权码后,才能使用邮件客户端登录。登录名必须填写完整邮箱地址,密码必须填写授权码,不能填写网页登录密码。
本地邮件服务默认启动,不依赖 SMTP 中继。以下开关只控制当前账号的客户端访问权限,不影响其他用户或服务监听。
</p>
</div>
<el-alert
title="授权码只在生成成功后显示一次,请立即保存;撤销授权码或关闭协议后,客户端会立即无法登录。"
title="登录名填写完整邮箱地址,密码填写本协议授权码,不能使用网页登录密码。授权码仅显示一次;关闭协议会暂停新登录,重新开启可继续使用未撤销的授权码。"
type="warning"
:closable="false"
show-icon
@@ -36,6 +36,7 @@
:loading="protocolLoading"
active-text="开启"
inactive-text="关闭"
:aria-label="`${protocolLabel(item.protocol)} 当前账号客户端访问`"
@change="value => setProtocolEnabled(item, value)"
/>
<el-button