修复认证验证码投递与登录入口体验 05-27-oa-auth-delivery-wecom-entry-fix
这个提交包含在:
@@ -51,6 +51,37 @@ function getTransporter(config) {
|
||||
return cachedTransporter;
|
||||
}
|
||||
|
||||
function resolveEmailDeliveryStatus(config) {
|
||||
const reasons = [];
|
||||
const authUser = String(config.smtpUser ?? '').trim();
|
||||
const authPass = String(config.smtpPass ?? '').trim();
|
||||
const smtpPort = Number(config.smtpPort);
|
||||
|
||||
if (!config.emailEnabled) {
|
||||
reasons.push('email_disabled');
|
||||
}
|
||||
if (!String(config.emailFrom ?? '').trim()) {
|
||||
reasons.push('email_from_missing');
|
||||
}
|
||||
if (!String(config.smtpHost ?? '').trim()) {
|
||||
reasons.push('smtp_host_missing');
|
||||
}
|
||||
if (!Number.isFinite(smtpPort) || smtpPort <= 0) {
|
||||
reasons.push('smtp_port_invalid');
|
||||
}
|
||||
if (authUser && !authPass) {
|
||||
reasons.push('smtp_auth_incomplete');
|
||||
}
|
||||
if (!authUser && authPass) {
|
||||
reasons.push('smtp_auth_incomplete');
|
||||
}
|
||||
|
||||
return {
|
||||
ready: reasons.length === 0,
|
||||
reasons,
|
||||
};
|
||||
}
|
||||
|
||||
function uniq(values) {
|
||||
return Array.from(new Set((values ?? []).filter(Boolean)));
|
||||
}
|
||||
@@ -168,6 +199,7 @@ async function sendNotificationEmail({
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
resolveEmailDeliveryStatus,
|
||||
sendNotificationEmailSafe,
|
||||
sendNotificationEmail,
|
||||
};
|
||||
|
||||
在新工单中引用
屏蔽一个用户