完善证书管理与邮件通知流程
This commit is contained in:
1 parent
c74372284a
commit
b2833b761d
60 files changed
+7340
-254
No files matched your search
@@ -336,7 +336,7 @@ const {
|
||||
name="sans"
|
||||
v-model="form.sans"
|
||||
rows="4"
|
||||
placeholder="www.example.com api.example.com"
|
||||
placeholder="www.example.com\napi.example.com"
|
||||
></textarea>
|
||||
</label>
|
||||
<div class="form-grid">
|
||||
@@ -547,7 +547,7 @@ const {
|
||||
><textarea
|
||||
v-model="serverForm.reload_command"
|
||||
rows="3"
|
||||
placeholder="nginx -s reload"
|
||||
placeholder="nginx -s reload"
|
||||
></textarea>
|
||||
</label>
|
||||
<p v-if="serverFormError" class="form-error">{{ serverFormError }}</p>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { computed, ref } from "vue";
|
||||
|
||||
const roleLabels = {
|
||||
super_admin: "\u8d85\u7ea7\u7ba1\u7406\u5458",
|
||||
admin: "\u7ba1\u7406\u5458",
|
||||
user: "\u666e\u901a\u7528\u6237",
|
||||
super_admin: "超级管理员",
|
||||
admin: "管理员",
|
||||
user: "普通用户",
|
||||
};
|
||||
|
||||
export function useLogin() {
|
||||
@@ -16,21 +16,21 @@ export function useLogin() {
|
||||
const accountRole = ref("");
|
||||
const accountName = ref("");
|
||||
|
||||
const identifierLabel = "\u7528\u6237\u540d\u6216\u90ae\u7bb1";
|
||||
const identifierPlaceholder = "\u8bf7\u8f93\u5165\u7528\u6237\u540d\u6216\u7ed1\u5b9a\u90ae\u7bb1";
|
||||
const identifierLabel = "用户名或邮箱";
|
||||
const identifierPlaceholder = "请输入用户名或绑定邮箱";
|
||||
const stageTitle = computed(() => {
|
||||
if (stage.value === "totp") return "\u4e24\u6b65\u9a8c\u8bc1";
|
||||
if (stage.value === "external_email") return "\u90ae\u7bb1\u9a8c\u8bc1";
|
||||
if (stage.value === "totp") return "两步验证";
|
||||
if (stage.value === "external_email") return "邮箱验证";
|
||||
if (stage.value === "complete") {
|
||||
return `${roleLabels[accountRole.value] || "\u7528\u6237"}\u767b\u5f55\u6210\u529f`;
|
||||
return `${roleLabels[accountRole.value] || "用户"}登录成功`;
|
||||
}
|
||||
return "\u7ba1\u7406\u5458\u767b\u5f55";
|
||||
return "管理员登录";
|
||||
});
|
||||
const stageMessage = computed(() => {
|
||||
if (stage.value === "totp") return "\u8be5\u8d26\u6237\u8fd8\u9700\u5b8c\u6210\u4e24\u6b65\u9a8c\u8bc1\u3002";
|
||||
if (stage.value === "external_email") return "\u8be5\u8d26\u6237\u8fd8\u9700\u5b8c\u6210\u7b2c\u4e09\u65b9\u90ae\u7bb1\u9a8c\u8bc1\u3002";
|
||||
if (stage.value === "complete") return "\u6b63\u5728\u8fdb\u5165 Scert \u7ba1\u7406\u540e\u53f0\u3002";
|
||||
return "\u8bf7\u8f93\u5165\u7528\u6237\u540d\u6216\u90ae\u7bb1\u3002\u8d26\u6237\u6743\u9650\u7531\u670d\u52a1\u7aef\u81ea\u52a8\u8bc6\u522b\u3002";
|
||||
if (stage.value === "totp") return "该账户还需完成两步验证。";
|
||||
if (stage.value === "external_email") return "该账户还需完成第三方邮箱验证。";
|
||||
if (stage.value === "complete") return "正在进入 Scert 管理后台。";
|
||||
return "请输入用户名或邮箱。账户权限由服务端自动识别。";
|
||||
});
|
||||
|
||||
function resetStage() {
|
||||
@@ -44,11 +44,11 @@ export function useLogin() {
|
||||
if (submitting.value || stage.value !== "credentials") return;
|
||||
error.value = "";
|
||||
if (!identifier.value.trim()) {
|
||||
error.value = "\u8bf7\u8f93\u5165\u7528\u6237\u540d\u6216\u90ae\u7bb1\u3002";
|
||||
error.value = "请输入用户名或邮箱。";
|
||||
return;
|
||||
}
|
||||
if (!password.value) {
|
||||
error.value = "\u8bf7\u8f93\u5165\u5bc6\u7801\u3002";
|
||||
error.value = "请输入密码。";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ export function useLogin() {
|
||||
});
|
||||
const result = await response.json().catch(() => ({}));
|
||||
if (!response.ok) {
|
||||
throw new Error(result.error || "\u767b\u5f55\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5");
|
||||
throw new Error(result.error || "登录失败,请稍后重试");
|
||||
}
|
||||
|
||||
accountRole.value = result.role || "";
|
||||
@@ -76,7 +76,7 @@ export function useLogin() {
|
||||
window.setTimeout(() => window.location.assign("/"), 600);
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message || "\u767b\u5f55\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5";
|
||||
error.value = err.message || "登录失败,请稍后重试";
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
color: #ffe5ad;
|
||||
}
|
||||
.setup-card {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
@@ -273,6 +275,33 @@ legend span {
|
||||
.two-columns {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.three-columns {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.compact-options {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.compact-row {
|
||||
min-height: 38px;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
|
||||
.compact-row span {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.compact-row strong {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.compact-row small {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
label {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
@@ -282,6 +311,20 @@ label {
|
||||
font-size: 10px;
|
||||
font-weight: 800;
|
||||
}
|
||||
.email-input-group {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(88px, 112px);
|
||||
gap: 6px;
|
||||
}
|
||||
.email-input-group input,
|
||||
.email-input-group select {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
@@ -1250,6 +1293,15 @@ footer .back-button {
|
||||
select {
|
||||
height: 26px;
|
||||
}
|
||||
.email-field {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
|
||||
.email-input-group {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(74px, 92px);
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
footer {
|
||||
min-height: 34px;
|
||||
@@ -1305,3 +1357,241 @@ footer .back-button {
|
||||
font-size: 8px;
|
||||
}
|
||||
}
|
||||
/* 移动端步骤内容压缩,确保复杂配置步骤完整显示 */
|
||||
@media (max-width: 600px) {
|
||||
.setup-card {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.setup-step-card {
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.setup-step-card .setup-grid {
|
||||
gap: 2px 5px;
|
||||
}
|
||||
|
||||
.setup-step-card label {
|
||||
gap: 1px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.setup-step-card input,
|
||||
.setup-step-card select {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.setup-step-card textarea {
|
||||
min-height: 30px;
|
||||
height: 30px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.setup-step-card .provider-description {
|
||||
margin-top: 2px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.setup-step-card .reset-preview span:first-of-type {
|
||||
display: block !important;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.setup-step-card .reset-preview span:last-of-type {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.setup-step-card .dns-test-actions {
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 390px) {
|
||||
.setup-step-card .setup-grid {
|
||||
gap: 1px 4px;
|
||||
}
|
||||
|
||||
.setup-step-card label {
|
||||
gap: 1px;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.setup-step-card input,
|
||||
.setup-step-card select {
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.setup-step-card textarea {
|
||||
min-height: 26px;
|
||||
height: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 901px) {
|
||||
.setup-notification-step:has(#email-http-enabled:checked) > .email-primary-grid,
|
||||
.setup-notification-step:has(#email-http-enabled:checked) > .email-delivery-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 4px 7px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) {
|
||||
padding: 12px 14px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) legend {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) label {
|
||||
gap: 2px;
|
||||
margin-top: 2px;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) label > span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) input,
|
||||
.setup-notification-step:has(#email-http-enabled:checked) select {
|
||||
height: 26px;
|
||||
padding: 0 8px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) textarea {
|
||||
min-height: 30px;
|
||||
height: 30px;
|
||||
padding: 4px 8px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .provider-description {
|
||||
overflow: hidden;
|
||||
margin-top: 3px;
|
||||
padding: 4px 8px;
|
||||
font-size: 9px;
|
||||
line-height: 1.25;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .email-option-grid {
|
||||
gap: 4px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .compact-row {
|
||||
min-height: 26px;
|
||||
padding: 4px 6px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 901px) and (max-height: 800px) {
|
||||
.setup-notification-step:has(#email-http-enabled:checked) label {
|
||||
gap: 1px;
|
||||
margin-top: 1px;
|
||||
font-size: 8px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) input,
|
||||
.setup-notification-step:has(#email-http-enabled:checked) select {
|
||||
height: 22px;
|
||||
padding: 0 6px;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) textarea {
|
||||
min-height: 24px;
|
||||
height: 24px;
|
||||
padding: 3px 6px;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 28px;
|
||||
margin-top: 2px;
|
||||
padding: 3px 6px;
|
||||
gap: 5px;
|
||||
font-size: 8px;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview strong,
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview span {
|
||||
display: inline !important;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview strong {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview span:first-of-type {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview span:last-of-type {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .email-option-grid {
|
||||
gap: 3px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .compact-row {
|
||||
min-height: 22px;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 901px) {
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 30px;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview strong,
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview span {
|
||||
display: inline !important;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview strong {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview span:first-of-type {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview span:last-of-type {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 901px) and (max-height: 800px) {
|
||||
.setup-notification-step:has(#email-http-enabled:checked) .reset-preview {
|
||||
height: 28px;
|
||||
gap: 5px;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,20 @@
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
|
||||
const commonEmailDomains = [
|
||||
{ label: "常用邮箱", value: "" },
|
||||
{ label: "@163.com", value: "163.com" },
|
||||
{ label: "@qq.com", value: "qq.com" },
|
||||
{ label: "@126.com", value: "126.com" },
|
||||
{ label: "@outlook.com", value: "outlook.com" },
|
||||
{ label: "@gmail.com", value: "gmail.com" },
|
||||
{ label: "@foxmail.com", value: "foxmail.com" },
|
||||
{ label: "@aliyun.com", value: "aliyun.com" },
|
||||
{ label: "@139.com", value: "139.com" },
|
||||
{ label: "@189.cn", value: "189.cn" },
|
||||
{ label: "自定义后缀", value: "custom" },
|
||||
];
|
||||
|
||||
|
||||
export function useSetupWizard(props, emit) {
|
||||
const scertLogo = "/Scert.png";
|
||||
|
||||
@@ -16,6 +31,8 @@ export function useSetupWizard(props, emit) {
|
||||
const dnsVerification = ref(null);
|
||||
const verificationClock = ref(Date.now());
|
||||
const currentStep = ref(1);
|
||||
const selectedEmailDomain = ref("");
|
||||
const emailLocalPart = ref("");
|
||||
let verificationTimer;
|
||||
const targetType = ref(props.status.web_public_ip ? "ip" : "hostname");
|
||||
const form = ref({
|
||||
@@ -24,8 +41,23 @@ export function useSetupWizard(props, emit) {
|
||||
admin_password: "",
|
||||
confirm_password: "",
|
||||
server_port: props.status.server_port || 8080,
|
||||
email_http_enabled: false,
|
||||
email_provider: "",
|
||||
email_endpoint: "",
|
||||
email_http_path: "/api/email/send",
|
||||
email_http_login_path: "/api/login",
|
||||
email_http_auth_mode: "none",
|
||||
email_http_credential_ref: "",
|
||||
email_http_headers: "",
|
||||
email_event_mode: "detailed",
|
||||
email_include_deployment_details: true,
|
||||
email_include_certificate_serial: true,
|
||||
email_include_management_url: true,
|
||||
email_sender_name: "Scert",
|
||||
email_sender_email: "",
|
||||
email_timeout_secs: 10,
|
||||
email_retry_count: 3,
|
||||
email_retry_intervals_secs: "30,120,600",
|
||||
recipients: "",
|
||||
dns_provider: props.status.dns_provider || "cloudflare",
|
||||
certificate_root: props.status.certificate_root || "",
|
||||
@@ -80,6 +112,52 @@ export function useSetupWizard(props, emit) {
|
||||
}).format(new Date(value));
|
||||
}
|
||||
|
||||
function handleEmailInput(value) {
|
||||
error.value = "";
|
||||
const rawValue = String(value || "").trim();
|
||||
|
||||
if (!rawValue) {
|
||||
emailLocalPart.value = "";
|
||||
selectedEmailDomain.value = "";
|
||||
form.value.admin_email = "";
|
||||
return;
|
||||
}
|
||||
|
||||
const atIndex = rawValue.indexOf("@");
|
||||
if (atIndex <= 0) {
|
||||
emailLocalPart.value = rawValue;
|
||||
form.value.admin_email = selectedEmailDomain.value && selectedEmailDomain.value !== "custom"
|
||||
? `${rawValue}@${selectedEmailDomain.value}`
|
||||
: rawValue;
|
||||
return;
|
||||
}
|
||||
|
||||
const localPart = rawValue.slice(0, atIndex).trim();
|
||||
const domain = rawValue.slice(atIndex + 1).trim().toLowerCase();
|
||||
emailLocalPart.value = localPart;
|
||||
selectedEmailDomain.value = commonEmailDomains.some(
|
||||
(option) => option.value === domain,
|
||||
)
|
||||
? domain
|
||||
: "custom";
|
||||
form.value.admin_email = `${localPart}@${domain}`;
|
||||
}
|
||||
|
||||
function applyEmailDomain(domain) {
|
||||
error.value = "";
|
||||
if (!domain || domain === "custom") return;
|
||||
|
||||
const currentEmail = form.value.admin_email.trim();
|
||||
const localPart = emailLocalPart.value.trim() || currentEmail.split("@")[0].trim();
|
||||
if (!localPart) {
|
||||
selectedEmailDomain.value = "";
|
||||
error.value = "请先输入邮箱名称,再选择常用邮箱。";
|
||||
return;
|
||||
}
|
||||
|
||||
emailLocalPart.value = localPart;
|
||||
form.value.admin_email = `${localPart}@${domain}`;
|
||||
}
|
||||
async function loadDNSProviders() {
|
||||
dnsCatalogLoading.value = true;
|
||||
dnsCatalogError.value = "";
|
||||
@@ -195,6 +273,29 @@ export function useSetupWizard(props, emit) {
|
||||
error.value = "请输入 1 至 65535 之间的主服务端口。";
|
||||
return false;
|
||||
}
|
||||
if (form.value.email_http_enabled && !form.value.email_endpoint.trim()) {
|
||||
error.value = "启用 HTTP 邮件通知后必须填写 API 地址。";
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
form.value.email_http_enabled &&
|
||||
form.value.email_http_auth_mode !== "none" &&
|
||||
!form.value.email_http_credential_ref.trim()
|
||||
) {
|
||||
error.value = "启用 HTTP 通知认证后必须填写凭据引用。";
|
||||
return false;
|
||||
}
|
||||
if (form.value.email_http_headers.trim()) {
|
||||
try {
|
||||
const headers = JSON.parse(form.value.email_http_headers);
|
||||
if (!headers || Array.isArray(headers) || typeof headers !== "object") {
|
||||
throw new Error("not-object");
|
||||
}
|
||||
} catch {
|
||||
error.value = "HTTP 自定义请求头必须是 JSON 对象。";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentStep.value === 3) {
|
||||
@@ -270,6 +371,18 @@ export function useSetupWizard(props, emit) {
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function emailHeaders() {
|
||||
if (!form.value.email_http_headers.trim()) return {};
|
||||
return JSON.parse(form.value.email_http_headers);
|
||||
}
|
||||
|
||||
function retryIntervals() {
|
||||
return form.value.email_retry_intervals_secs
|
||||
.split(/[,,]/)
|
||||
.map((item) => Number(item.trim()))
|
||||
.filter((item) => Number.isInteger(item) && item > 0);
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
error.value = "";
|
||||
resultMessage.value = "";
|
||||
@@ -304,8 +417,25 @@ export function useSetupWizard(props, emit) {
|
||||
admin_email: form.value.admin_email,
|
||||
admin_password: form.value.admin_password,
|
||||
server_port: Number(form.value.server_port),
|
||||
email_http_enabled: form.value.email_http_enabled,
|
||||
email_provider: form.value.email_provider,
|
||||
email_endpoint: form.value.email_endpoint,
|
||||
email_http_path: form.value.email_http_path,
|
||||
email_http_login_path: form.value.email_http_login_path,
|
||||
email_http_auth_mode: form.value.email_http_auth_mode,
|
||||
email_http_credential_ref: form.value.email_http_credential_ref,
|
||||
email_http_headers: emailHeaders(),
|
||||
email_event_mode: form.value.email_event_mode,
|
||||
email_include_deployment_details:
|
||||
form.value.email_include_deployment_details,
|
||||
email_include_certificate_serial:
|
||||
form.value.email_include_certificate_serial,
|
||||
email_include_management_url: form.value.email_include_management_url,
|
||||
email_sender_name: form.value.email_sender_name,
|
||||
email_sender_email: form.value.email_sender_email,
|
||||
email_timeout_secs: Number(form.value.email_timeout_secs),
|
||||
email_retry_count: Number(form.value.email_retry_count),
|
||||
email_retry_intervals_secs: retryIntervals(),
|
||||
recipients: recipients(),
|
||||
dns_provider: form.value.dns_provider,
|
||||
dns_credential_ref: dnsVerification.value.credential_ref,
|
||||
@@ -367,11 +497,16 @@ export function useSetupWizard(props, emit) {
|
||||
currentStep,
|
||||
targetType,
|
||||
form,
|
||||
commonEmailDomains,
|
||||
selectedEmailDomain,
|
||||
emailLocalPart,
|
||||
targetLabel,
|
||||
resetURLPreview,
|
||||
selectedDNSProvider,
|
||||
dnsVerificationValid,
|
||||
formatVerificationExpiry,
|
||||
applyEmailDomain,
|
||||
handleEmailInput,
|
||||
testDNS,
|
||||
handleSubmit,
|
||||
previousStep,
|
||||
|
||||
@@ -27,11 +27,16 @@ const {
|
||||
currentStep,
|
||||
targetType,
|
||||
form,
|
||||
commonEmailDomains,
|
||||
selectedEmailDomain,
|
||||
emailLocalPart,
|
||||
targetLabel,
|
||||
resetURLPreview,
|
||||
selectedDNSProvider,
|
||||
dnsVerificationValid,
|
||||
formatVerificationExpiry,
|
||||
applyEmailDomain,
|
||||
handleEmailInput,
|
||||
testDNS,
|
||||
handleSubmit,
|
||||
previousStep,
|
||||
@@ -109,17 +114,37 @@ const {
|
||||
autocomplete="username"
|
||||
placeholder="例如 scert-admin"
|
||||
/></label>
|
||||
<label
|
||||
<label class="email-field"
|
||||
><span>绑定邮箱</span
|
||||
><input
|
||||
><div class="email-input-group">
|
||||
<input
|
||||
id="admin-email"
|
||||
name="admin_email"
|
||||
v-model.trim="form.admin_email"
|
||||
:value="emailLocalPart"
|
||||
@input="handleEmailInput($event.target.value)"
|
||||
required
|
||||
type="email"
|
||||
type="text"
|
||||
autocomplete="email"
|
||||
placeholder="用于登录和安全通知"
|
||||
/></label>
|
||||
inputmode="email"
|
||||
placeholder="输入邮箱名称,例如 likb_blue"
|
||||
/>
|
||||
<select
|
||||
id="admin-email-domain"
|
||||
v-model="selectedEmailDomain"
|
||||
aria-label="常用邮箱"
|
||||
@change="applyEmailDomain(selectedEmailDomain)"
|
||||
>
|
||||
<option
|
||||
v-for="option in commonEmailDomains"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
>
|
||||
{{ option.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<small>可直接输入完整邮箱,也可先输入邮箱名称再选择常用邮箱。</small>
|
||||
</label>
|
||||
<label
|
||||
><span>密码</span
|
||||
><input
|
||||
@@ -147,9 +172,9 @@ const {
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset v-if="currentStep === 2" class="setup-step-card">
|
||||
<fieldset v-if="currentStep === 2" class="setup-step-card setup-notification-step">
|
||||
<legend><span>02</span>服务与通知</legend>
|
||||
<div class="setup-grid two-columns">
|
||||
<div class="setup-grid two-columns email-primary-grid">
|
||||
<label
|
||||
><span>Scert 主服务端口</span
|
||||
><input
|
||||
@@ -161,7 +186,14 @@ const {
|
||||
max="65535"
|
||||
type="number"
|
||||
/></label>
|
||||
<label
|
||||
<label class="confirm-row compact-row"
|
||||
><input
|
||||
id="email-http-enabled"
|
||||
v-model="form.email_http_enabled"
|
||||
type="checkbox"
|
||||
/><span><strong>启用 HTTP 邮件通知</strong><small>兼容 Smail 等 HTTP 邮件服务。</small></span></label
|
||||
>
|
||||
<label v-if="form.email_http_enabled"
|
||||
><span>第三方邮箱服务标识</span
|
||||
><input
|
||||
id="email-provider"
|
||||
@@ -169,7 +201,7 @@ const {
|
||||
v-model.trim="form.email_provider"
|
||||
placeholder="例如 company-mail-api"
|
||||
/></label>
|
||||
<label
|
||||
<label v-if="form.email_http_enabled"
|
||||
><span>邮件 API 地址</span
|
||||
><input
|
||||
id="email-endpoint"
|
||||
@@ -178,6 +210,58 @@ const {
|
||||
type="url"
|
||||
placeholder="https://mail.example.com/send"
|
||||
/></label>
|
||||
<label v-if="form.email_http_enabled"
|
||||
><span>HTTP 请求路径</span
|
||||
><input
|
||||
id="email-http-path"
|
||||
v-model.trim="form.email_http_path"
|
||||
placeholder="/api/email/send"
|
||||
/></label>
|
||||
<label v-if="form.email_http_enabled"
|
||||
><span>HTTP 认证方式</span
|
||||
><select
|
||||
id="email-http-auth-mode"
|
||||
v-model="form.email_http_auth_mode"
|
||||
>
|
||||
<option value="none">无认证</option>
|
||||
<option value="bearer">Bearer Token</option>
|
||||
<option value="hmac_sha256">HMAC-SHA256</option>
|
||||
<option value="session">账号登录会话</option>
|
||||
</select></label
|
||||
>
|
||||
<label
|
||||
v-if="
|
||||
form.email_http_enabled &&
|
||||
form.email_http_auth_mode === 'session'
|
||||
"
|
||||
><span>登录请求路径</span
|
||||
><input
|
||||
id="email-http-login-path"
|
||||
v-model.trim="form.email_http_login_path"
|
||||
placeholder="/api/login"
|
||||
/></label>
|
||||
<label v-if="form.email_http_enabled"
|
||||
><span>凭据引用</span
|
||||
><input
|
||||
id="email-http-credential-ref"
|
||||
v-model.trim="form.email_http_credential_ref"
|
||||
placeholder="secret://notification/mail"
|
||||
/></label>
|
||||
<label v-if="form.email_http_enabled"
|
||||
><span>发件人名称</span
|
||||
><input
|
||||
id="email-sender-name"
|
||||
v-model.trim="form.email_sender_name"
|
||||
placeholder="Scert"
|
||||
/></label>
|
||||
<label v-if="form.email_http_enabled"
|
||||
><span>发件人地址</span
|
||||
><input
|
||||
id="email-sender-email"
|
||||
v-model.trim="form.email_sender_email"
|
||||
type="email"
|
||||
placeholder="留空使用管理员邮箱"
|
||||
/></label>
|
||||
</div>
|
||||
<div class="provider-description reset-preview">
|
||||
<strong>密码重置地址</strong><span>{{ resetURLPreview }}</span
|
||||
@@ -186,7 +270,7 @@ const {
|
||||
后,此地址才会临时可用。</span
|
||||
>
|
||||
</div>
|
||||
<label
|
||||
<label v-if="form.email_http_enabled"
|
||||
><span>通知收件人</span
|
||||
><input
|
||||
id="recipients"
|
||||
@@ -194,6 +278,54 @@ const {
|
||||
v-model="form.recipients"
|
||||
placeholder="多个地址使用逗号分隔"
|
||||
/></label>
|
||||
<div v-if="form.email_http_enabled" class="setup-grid two-columns email-delivery-grid">
|
||||
<label
|
||||
><span>通知事件模式</span
|
||||
><select v-model="form.email_event_mode">
|
||||
<option value="detailed">详细事件</option>
|
||||
<option value="unified">统一事件</option>
|
||||
</select></label
|
||||
>
|
||||
<label
|
||||
><span>请求超时(秒)</span
|
||||
><input
|
||||
v-model.number="form.email_timeout_secs"
|
||||
type="number"
|
||||
min="1"
|
||||
/></label>
|
||||
<label
|
||||
><span>重试次数</span
|
||||
><input
|
||||
v-model.number="form.email_retry_count"
|
||||
type="number"
|
||||
min="1"
|
||||
/></label>
|
||||
<label
|
||||
><span>重试间隔(秒)</span
|
||||
><input
|
||||
v-model.trim="form.email_retry_intervals_secs"
|
||||
placeholder="30,120,600"
|
||||
/></label>
|
||||
</div>
|
||||
<label v-if="form.email_http_enabled" class="email-headers-field"
|
||||
><span>HTTP 自定义请求头(JSON)</span
|
||||
><textarea
|
||||
v-model.trim="form.email_http_headers"
|
||||
rows="2"
|
||||
placeholder='例如:{"X-Tenant":"scert"}'
|
||||
></textarea
|
||||
></label>
|
||||
<div v-if="form.email_http_enabled" class="setup-grid three-columns compact-options email-option-grid">
|
||||
<label class="confirm-row compact-row"
|
||||
><input v-model="form.email_include_deployment_details" type="checkbox" /><span>部署明细</span></label
|
||||
>
|
||||
<label class="confirm-row compact-row"
|
||||
><input v-model="form.email_include_certificate_serial" type="checkbox" /><span>证书序列号</span></label
|
||||
>
|
||||
<label class="confirm-row compact-row"
|
||||
><input v-model="form.email_include_management_url" type="checkbox" /><span>管理后台链接</span></label
|
||||
>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset v-if="currentStep === 3" class="setup-step-card">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.super-admin-reset-card {
|
||||
.reset-card {
|
||||
width: min(100%, 520px);
|
||||
max-width: 520px;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ const {
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<section class="access-card super-admin-reset-card">
|
||||
<section class="access-card reset-card">
|
||||
<header class="access-card-header">
|
||||
<p class="access-eyebrow">临时授权</p>
|
||||
<h2 class="access-card-title">确认安全重置</h2>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
.access-shell {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: min(calc(100% - 48px), 1120px);
|
||||
height: min(680px, calc(100dvh - 48px));
|
||||
min-height: 520px;
|
||||
width: min(1120px, calc(100vw - 32px));
|
||||
max-width: calc(100vw - 32px);
|
||||
height: min(680px, calc(100vh - 32px));
|
||||
max-height: calc(100vh - 32px);
|
||||
min-height: 0;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1.58fr);
|
||||
grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1.66fr);
|
||||
overflow: hidden;
|
||||
transform: translate(-50%, -50%);
|
||||
border: 1px solid rgba(213, 224, 239, 0.95);
|
||||
@@ -17,14 +19,18 @@
|
||||
}
|
||||
|
||||
.access-shell--setup {
|
||||
width: min(calc(100% - 48px), 1360px);
|
||||
height: min(760px, calc(100dvh - 40px));
|
||||
min-height: 600px;
|
||||
width: min(1360px, calc(100vw - 32px));
|
||||
max-width: calc(100vw - 32px);
|
||||
height: min(760px, calc(100vh - 32px));
|
||||
max-height: calc(100vh - 32px);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.access-shell--compact {
|
||||
width: min(calc(100% - 48px), 1040px);
|
||||
height: min(640px, calc(100dvh - 48px));
|
||||
width: min(1040px, calc(100vw - 32px));
|
||||
max-width: calc(100vw - 32px);
|
||||
height: min(640px, calc(100vh - 32px));
|
||||
max-height: calc(100vh - 32px);
|
||||
}
|
||||
|
||||
.access-brand {
|
||||
@@ -76,7 +82,7 @@
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
padding: clamp(22px, 1.8vw, 30px) clamp(10px, 1.2vw, 18px);
|
||||
padding: clamp(20px, 1.8vw, 30px) clamp(12px, 1.2vw, 18px);
|
||||
}
|
||||
|
||||
.access-logo {
|
||||
@@ -100,7 +106,7 @@
|
||||
max-width: 100%;
|
||||
margin: 0 0 14px;
|
||||
color: #ffffff;
|
||||
font-size: clamp(18px, 1.45vw, 24px);
|
||||
font-size: clamp(17px, 1.35vw, 23px);
|
||||
letter-spacing: -0.08em;
|
||||
line-height: 1.16;
|
||||
white-space: nowrap;
|
||||
@@ -117,6 +123,7 @@
|
||||
.access-panel {
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user