精简初始化通知设置并默认使用Smail系统通知身份发信
This commit is contained in:
1 parent
229d150a08
commit
a9937c3e6a
16 files changed
+186
-48
No files matched your search
@@ -1108,8 +1108,8 @@ button:disabled {
|
||||
|
||||
.notification-service-row,
|
||||
.notification-api-row,
|
||||
.notification-sender-row {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
.notification-recipient-row {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.notification-auth-row {
|
||||
|
||||
@@ -84,8 +84,6 @@ export function useSetupWizard(props, emit) {
|
||||
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",
|
||||
@@ -687,8 +685,6 @@ export function useSetupWizard(props, emit) {
|
||||
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(),
|
||||
|
||||
@@ -365,12 +365,17 @@ const {
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>SMTP 用户名</span>
|
||||
<span>
|
||||
SMTP 用户名
|
||||
<HelpTip>
|
||||
使用 Smail 系统通知页提供的 notify:账号@邮件域名和专用发信凭据,自动使用系统通知发件人,不使用管理员邮箱。
|
||||
</HelpTip>
|
||||
</span>
|
||||
<input
|
||||
id="email-smtp-username"
|
||||
name="email_smtp_username"
|
||||
v-model.trim="form.email_smtp_username"
|
||||
placeholder="发件邮箱或账号"
|
||||
placeholder="notify:账号@邮件域名"
|
||||
autocomplete="username"
|
||||
/>
|
||||
</label>
|
||||
@@ -381,7 +386,7 @@ const {
|
||||
name="email_smtp_password"
|
||||
v-model="form.email_smtp_password"
|
||||
type="password"
|
||||
placeholder="请输入 SMTP 密码或授权码"
|
||||
placeholder="请输入 Smail 系统通知发信凭据"
|
||||
autocomplete="new-password"
|
||||
/>
|
||||
</label>
|
||||
@@ -409,24 +414,7 @@ const {
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="notification-row notification-sender-row">
|
||||
<label>
|
||||
<span>发件人名称</span>
|
||||
<input
|
||||
id="email-sender-name"
|
||||
v-model.trim="form.email_sender_name"
|
||||
placeholder="Scert"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>发件人地址(可选)</span>
|
||||
<input
|
||||
id="email-sender-email"
|
||||
v-model.trim="form.email_sender_email"
|
||||
type="email"
|
||||
placeholder="留空使用管理员邮箱"
|
||||
/>
|
||||
</label>
|
||||
<div class="notification-row notification-recipient-row">
|
||||
<label>
|
||||
<span>
|
||||
通知收件人
|
||||
@@ -444,12 +432,6 @@ const {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="provider-description reset-preview">
|
||||
<strong>密码重置地址</strong>
|
||||
<span>{{ resetURLPreview }}</span>
|
||||
<span>只有手动启动 Scert-admin 后,此地址才会临时可用。</span>
|
||||
</div>
|
||||
|
||||
<div v-if="form.email_smtp_enabled" class="notification-advanced-panel">
|
||||
<button
|
||||
class="notification-advanced-toggle"
|
||||
|
||||
@@ -112,7 +112,9 @@ for (const driver of ["sqlite", "mysql", "postgres"]) {
|
||||
email_http_auth_mode: "bearer",
|
||||
email_smtp_enabled: true,
|
||||
email_smtp_host: "smtp.example.test",
|
||||
email_smtp_username: "sender@example.test",
|
||||
email_smtp_username: "notify:sender@example.test",
|
||||
email_sender_name: "Ignored sender",
|
||||
email_sender_email: "ignored@example.test",
|
||||
email_smtp_password: "smtp-test-only",
|
||||
email_retry_count: 0,
|
||||
recipients: "first@example.test,second@example.test",
|
||||
@@ -134,13 +136,13 @@ for (const driver of ["sqlite", "mysql", "postgres"]) {
|
||||
assert.equal(submitted[0].notification.http_enabled, false);
|
||||
assert.equal(submitted[0].notification.smtp_enabled, true);
|
||||
assert.equal(submitted[0].notification.smtp_host, "smtp.example.test");
|
||||
assert.equal(submitted[0].notification.smtp_username, "sender@example.test");
|
||||
assert.equal(submitted[0].notification.smtp_username, "notify:sender@example.test");
|
||||
assert.equal(submitted[0].notification.smtp_password, "smtp-test-only");
|
||||
assert.equal(submitted[0].notification.smtp_port, 587);
|
||||
assert.equal(submitted[0].notification.smtp_mode, "starttls");
|
||||
assert.equal(submitted[0].notification.retry_count, 0);
|
||||
assert.deepEqual(submitted[0].notification.recipients, ["first@example.test", "second@example.test"]);
|
||||
for (const key of ["endpoint", "http_auth_mode", "http_credentials", "http_path", "http_headers"]) {
|
||||
for (const key of ["endpoint", "http_auth_mode", "http_credentials", "http_path", "http_headers", "sender_name", "sender_email"]) {
|
||||
assert.equal(Object.hasOwn(submitted[0].notification, key), false);
|
||||
}
|
||||
assert.equal(submitted[0].certificate_root, "/srv/scert/ssl");
|
||||
|
||||
@@ -33,23 +33,25 @@ test("certificate root remains editable during bootstrap", () => {
|
||||
&& prop.exp?.content === "form.certificate_root"));
|
||||
});
|
||||
|
||||
test("notification step exposes SMTP only and keeps sender fields in its panel", () => {
|
||||
test("notification step uses the system sender and keeps only recipient settings", () => {
|
||||
const root = template("./SetupWizard.vue");
|
||||
const step = find(root, hasClass("setup-notification-step"));
|
||||
const panel = find(step, hasClass("smtp-basic-panel"));
|
||||
const id = (value) => (node) => node.props?.some((prop) =>
|
||||
prop.name === "id" && prop.value?.content === value);
|
||||
assert.ok(find(step, id("email-smtp-enabled")));
|
||||
for (const value of ["email-http-enabled", "email-endpoint", "email-http-path", "email-http-auth-mode"]) {
|
||||
for (const value of ["email-http-enabled", "email-endpoint", "email-http-path", "email-http-auth-mode", "email-sender-name", "email-sender-email"]) {
|
||||
assert.equal(find(step, id(value)), undefined);
|
||||
}
|
||||
for (const value of ["email-smtp-host", "email-smtp-password", "email-sender-name", "email-sender-email", "recipients"]) {
|
||||
for (const value of ["email-smtp-host", "email-smtp-password", "recipients"]) {
|
||||
assert.ok(find(panel, id(value)), value);
|
||||
}
|
||||
const advanced = find(step, hasClass("notification-advanced-panel"));
|
||||
assert.equal(advanced.props.find((prop) => prop.name === "if").exp.content, "form.email_smtp_enabled");
|
||||
assert.ok(find(advanced, hasClass("notification-delivery-row")));
|
||||
assert.ok(find(advanced, hasClass("email-option-grid")));
|
||||
assert.equal(find(step, hasClass("reset-preview")), undefined);
|
||||
assert.ok(find(panel, hasClass("notification-recipient-row")));
|
||||
});
|
||||
|
||||
test("notification checkboxes stay compact and centered with their labels", () => {
|
||||
|
||||
Reference in new issue
Block a user