edit
(cherry picked from commit c3434af8a5f06668ee89759abd9320cb15653cd0)
This commit is contained in:
@@ -337,7 +337,11 @@ const en = {
|
||||
searchUser: 'Search by user',
|
||||
searchEmail: 'Search by Email',
|
||||
searchSender: 'Search by Sender',
|
||||
userEmail: 'Email Address'
|
||||
userEmail: 'Email Address',
|
||||
oauthSetting: 'OAuth',
|
||||
clientId: 'Client ID',
|
||||
clientSecret: 'Client Secret',
|
||||
callbackBase: 'https://domain',
|
||||
}
|
||||
|
||||
export default en
|
||||
|
||||
@@ -337,6 +337,10 @@ const zh = {
|
||||
searchUser: '搜索用户',
|
||||
searchEmail: '搜索邮箱',
|
||||
searchSender: '搜索发件人',
|
||||
userEmail: '用户邮箱'
|
||||
userEmail: '用户邮箱',
|
||||
oauthSetting: 'OAuth',
|
||||
clientId: '客户端 ID',
|
||||
clientSecret: '客户端密钥',
|
||||
callbackBase: 'https://domain',
|
||||
}
|
||||
export default zh
|
||||
|
||||
@@ -492,11 +492,13 @@
|
||||
</form>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="oauthSettingShow" :title="$t('oauthSetting') + ' - ' + oauthForm.label" width="340"
|
||||
@closed="oauthForm.clientId = ''; oauthForm.clientSecret = ''; oauthForm.callbackUrl = ''">
|
||||
@closed="oauthForm.clientId = ''; oauthForm.clientSecret = ''; oauthForm.callbackBase = ''">
|
||||
<div class="dialog-content">
|
||||
<el-input type="text" :placeholder="$t('clientId')" v-model="oauthForm.clientId"/>
|
||||
<el-input type="text" style="margin-top: 15px" :placeholder="$t('clientSecret')" v-model="oauthForm.clientSecret"/>
|
||||
<el-input type="text" style="margin-top: 15px" :placeholder="$t('callbackUrl')" v-model="oauthForm.callbackUrl"/>
|
||||
<el-input type="text" style="margin-top: 15px" :placeholder="$t('callbackBase')" v-model="oauthForm.callbackBase">
|
||||
<template #append>/login/{{ oauthForm.key }}</template>
|
||||
</el-input>
|
||||
<div style="display: flex; justify-content: flex-end; margin-top: 15px;">
|
||||
<el-button type="primary" @click="saveOauth">{{ $t('save') }}</el-button>
|
||||
</div>
|
||||
@@ -914,7 +916,7 @@ const oauthForm = reactive({
|
||||
label: '',
|
||||
clientId: '',
|
||||
clientSecret: '',
|
||||
callbackUrl: '',
|
||||
callbackBase: '',
|
||||
})
|
||||
|
||||
const s3 = reactive({
|
||||
@@ -1379,7 +1381,9 @@ function openOauthSetting(p) {
|
||||
oauthForm.label = p.label
|
||||
oauthForm.clientId = setting.value[p.key + 'ClientId'] || ''
|
||||
oauthForm.clientSecret = setting.value[p.key + 'ClientSecret'] || ''
|
||||
oauthForm.callbackUrl = setting.value[p.key + 'CallbackUrl'] || ''
|
||||
const suffix = '/login/' + p.key
|
||||
const fullUrl = setting.value[p.key + 'CallbackUrl'] || ''
|
||||
oauthForm.callbackBase = fullUrl.endsWith(suffix) ? fullUrl.slice(0, -suffix.length) : fullUrl
|
||||
oauthSettingShow.value = true
|
||||
}
|
||||
|
||||
@@ -1387,7 +1391,7 @@ function saveOauth() {
|
||||
const form = {}
|
||||
form[oauthForm.key + 'ClientId'] = oauthForm.clientId
|
||||
form[oauthForm.key + 'ClientSecret'] = oauthForm.clientSecret
|
||||
form[oauthForm.key + 'CallbackUrl'] = oauthForm.callbackUrl
|
||||
form[oauthForm.key + 'CallbackUrl'] = oauthForm.callbackBase + '/login/' + oauthForm.key
|
||||
editSetting(form)
|
||||
oauthSettingShow.value = false
|
||||
}
|
||||
|
||||
@@ -130,6 +130,16 @@ const settingService = {
|
||||
}
|
||||
|
||||
params.resendTokens = JSON.stringify(resendTokens);
|
||||
|
||||
const callbackPlatforms = ['linuxdo', 'github', 'gitlab', 'google'];
|
||||
for (const platform of callbackPlatforms) {
|
||||
const key = platform + 'CallbackUrl';
|
||||
const expectedSuffix = '/login/' + platform;
|
||||
if (params[key] && !params[key].endsWith(expectedSuffix)) {
|
||||
throw new BizError(`Invalid callback URL for ${platform}: must end with ${expectedSuffix}`);
|
||||
}
|
||||
}
|
||||
|
||||
await orm(c).update(setting).set({ ...params }).returning().get();
|
||||
await this.refresh(c);
|
||||
},
|
||||
|
||||
@@ -44,10 +44,10 @@ admin = "${ADMIN}"
|
||||
jwt_secret = "${JWT_SECRET}"
|
||||
project_link = "${PROJECT_LINK}"
|
||||
|
||||
linuxdo_client_id = "${LINUXDO_CLIENT_ID}"
|
||||
linuxdo_client_secret = "${LINUXDO_CLIENT_SECRET}"
|
||||
linuxdo_callback_url = "${LINUXDO_CALLBACK_URL}"
|
||||
linuxdo_switch = "${LINUXDO_SWITCH}"
|
||||
github_switch = "${GITHUB_SWITCH}"
|
||||
gitlab_switch = "${GITLAB_SWITCH}"
|
||||
google_switch = "${GOOGLE_SWITCH}"
|
||||
|
||||
[build]
|
||||
command = "pnpm --prefix ../mail-vue install && pnpm --prefix ../mail-vue run build"
|
||||
|
||||
@@ -36,12 +36,16 @@ crons = ["0 16 * * *"] #每天晚上12点执行每日任务,刷新分析缓存
|
||||
|
||||
|
||||
[vars]
|
||||
#ai_model = "" #ai模型,不填默认使用@cf/meta/llama-3.1-8b-instruct
|
||||
#analysis_cache = false #是否开启分析数据缓存
|
||||
#ai_model = "" #ai模型,不填默认使用@cf/meta/llama-3.1-8b-instruct
|
||||
#analysis_cache = false #是否开启分析数据缓存
|
||||
#orm_log = false #是否sql日志
|
||||
#domain = [] #邮件域名可可配置多个 示例: ["example1.com","example2.com"]
|
||||
#admin = "" #管理员的邮箱 示例: [email protected]
|
||||
#admin = "" #管理员的邮箱 示例: [email protected]
|
||||
#jwt_secret = "" #jwt令牌的密钥,随便填一串字符串
|
||||
#linuxdo_switch = "" #LinuxDo OAuth 开关
|
||||
#github_switch = "" #GitHub OAuth 开关
|
||||
#gitlab_switch = "" #GitLab OAuth 开关
|
||||
#google_switch = "" #Google OAuth 开关
|
||||
|
||||
[build]
|
||||
command = "pnpm --prefix ../mail-vue install && pnpm --prefix ../mail-vue run build"
|
||||
|
||||
Reference in New Issue
Block a user