|
|
@ -16,6 +16,7 @@ type GlobalConfigPayload = { |
|
|
commentSmtpSecure: boolean |
|
|
commentSmtpSecure: boolean |
|
|
commentSmtpUser: string |
|
|
commentSmtpUser: string |
|
|
commentSmtpPass: string |
|
|
commentSmtpPass: string |
|
|
|
|
|
commentSmtpPassConfigured?: boolean |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -38,18 +39,20 @@ const commentSmtpPort = ref(465) |
|
|
const commentSmtpSecure = ref(true) |
|
|
const commentSmtpSecure = ref(true) |
|
|
const commentSmtpUser = ref('') |
|
|
const commentSmtpUser = ref('') |
|
|
const commentSmtpPass = ref('') |
|
|
const commentSmtpPass = ref('') |
|
|
|
|
|
const commentSmtpPassConfigured = ref(false) |
|
|
|
|
|
|
|
|
const commentEmailConfigReady = computed(() => { |
|
|
const commentEmailConfigReady = computed(() => { |
|
|
const from = commentMailFromEmail.value.trim() |
|
|
const from = commentMailFromEmail.value.trim() |
|
|
const host = commentSmtpHost.value.trim() |
|
|
const host = commentSmtpHost.value.trim() |
|
|
const user = commentSmtpUser.value.trim() |
|
|
const user = commentSmtpUser.value.trim() |
|
|
const pass = commentSmtpPass.value.trim() |
|
|
const pass = commentSmtpPass.value.trim() |
|
|
|
|
|
const hasPass = pass.length > 0 || commentSmtpPassConfigured.value |
|
|
const port = Number(commentSmtpPort.value) |
|
|
const port = Number(commentSmtpPort.value) |
|
|
return ( |
|
|
return ( |
|
|
from.length > 0 |
|
|
from.length > 0 |
|
|
&& host.length > 0 |
|
|
&& host.length > 0 |
|
|
&& user.length > 0 |
|
|
&& user.length > 0 |
|
|
&& pass.length > 0 |
|
|
&& hasPass |
|
|
&& Number.isFinite(port) |
|
|
&& Number.isFinite(port) |
|
|
&& port >= 1 |
|
|
&& port >= 1 |
|
|
&& port <= 65535 |
|
|
&& port <= 65535 |
|
|
@ -77,7 +80,10 @@ async function load() { |
|
|
commentSmtpPort.value = cfg.commentSmtpPort |
|
|
commentSmtpPort.value = cfg.commentSmtpPort |
|
|
commentSmtpSecure.value = cfg.commentSmtpSecure |
|
|
commentSmtpSecure.value = cfg.commentSmtpSecure |
|
|
commentSmtpUser.value = cfg.commentSmtpUser |
|
|
commentSmtpUser.value = cfg.commentSmtpUser |
|
|
commentSmtpPass.value = cfg.commentSmtpPass |
|
|
commentSmtpPass.value = '' |
|
|
|
|
|
commentSmtpPassConfigured.value = typeof cfg.commentSmtpPassConfigured === 'boolean' |
|
|
|
|
|
? cfg.commentSmtpPassConfigured |
|
|
|
|
|
: false |
|
|
} finally { |
|
|
} finally { |
|
|
loading.value = false |
|
|
loading.value = false |
|
|
} |
|
|
} |
|
|
@ -111,6 +117,8 @@ async function save() { |
|
|
const nextCommentSmtpPass = commentSmtpPass.value.trim() |
|
|
const nextCommentSmtpPass = commentSmtpPass.value.trim() |
|
|
if (nextCommentSmtpPass.length > 0) { |
|
|
if (nextCommentSmtpPass.length > 0) { |
|
|
await putKey('commentSmtpPass', nextCommentSmtpPass) |
|
|
await putKey('commentSmtpPass', nextCommentSmtpPass) |
|
|
|
|
|
commentSmtpPassConfigured.value = true |
|
|
|
|
|
commentSmtpPass.value = '' |
|
|
} |
|
|
} |
|
|
await load() |
|
|
await load() |
|
|
await refreshGlobalConfig() |
|
|
await refreshGlobalConfig() |
|
|
|