fix: correct display of email verification message toast (#6822)

#### What type of PR is this?

/area core
/kind bug
/milestone 2.20.x

#### What this PR does / why we need it:

修复不能正常显示邮箱验证提示的问题。

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/6829/head
Ryan Wang 2024-10-11 17:27:05 +08:00 committed by GitHub
parent 59a59715a1
commit d63eaed10f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 41 additions and 41 deletions

View File

@ -1,11 +1,11 @@
<form <form
th:fragment="form" th:fragment="form"
class="halo-form" class="halo-form"
name="signup-form" name="signup-form"
id="signup-form" id="signup-form"
th:action="@{/signup}" th:action="@{/signup}"
th:object="${form}" th:object="${form}"
method="post" method="post"
> >
<div class="alert alert-error" role="alert" th:if="${error == 'invalid-email-code'}"> <div class="alert alert-error" role="alert" th:if="${error == 'invalid-email-code'}">
<strong> <strong>
@ -27,18 +27,18 @@
<label for="username" th:text="#{form.username.label}"></label> <label for="username" th:text="#{form.username.label}"></label>
<div class="form-input"> <div class="form-input">
<input <input
type="text" type="text"
id="username" id="username"
name="username" name="username"
autocomplete="off" autocomplete="off"
spellcheck="false" spellcheck="false"
autocorrect="off" autocorrect="off"
autocapitalize="off" autocapitalize="off"
autofocus autofocus
required required
minlength="4" minlength="4"
maxlength="63" maxlength="63"
th:field="*{username}" th:field="*{username}"
/> />
</div> </div>
<p class="alert alert-error" th:if="${#fields.hasErrors('username')}" th:errors="*{username}"></p> <p class="alert alert-error" th:if="${#fields.hasErrors('username')}" th:errors="*{username}"></p>
@ -48,15 +48,15 @@
<label for="displayName" th:text="#{form.displayName.label}"></label> <label for="displayName" th:text="#{form.displayName.label}"></label>
<div class="form-input"> <div class="form-input">
<input <input
type="text" type="text"
id="displayName" id="displayName"
name="displayName" name="displayName"
autocomplete="off" autocomplete="off"
spellcheck="false" spellcheck="false"
autocorrect="off" autocorrect="off"
autocapitalize="off" autocapitalize="off"
required required
th:field="*{displayName}" th:field="*{displayName}"
/> />
</div> </div>
<p class="alert alert-error" th:if="${#fields.hasErrors('displayName')}" th:errors="*{displayName}"></p> <p class="alert alert-error" th:if="${#fields.hasErrors('displayName')}" th:errors="*{displayName}"></p>
@ -68,15 +68,15 @@
<label for="email" th:text="#{form.email.label}"></label> <label for="email" th:text="#{form.email.label}"></label>
<div class="form-input"> <div class="form-input">
<input <input
type="email" type="email"
id="email" id="email"
name="email" name="email"
autocomplete="off" autocomplete="off"
spellcheck="false" spellcheck="false"
autocorrect="off" autocorrect="off"
autocapitalize="off" autocapitalize="off"
required required
th:field="*{email}" th:field="*{email}"
/> />
</div> </div>
<p class="alert alert-error" th:if="${#fields.hasErrors('email')}" th:errors="*{email}"></p> <p class="alert alert-error" th:if="${#fields.hasErrors('email')}" th:errors="*{email}"></p>
@ -98,7 +98,7 @@
<div class="form-item"> <div class="form-item">
<label for="password" th:text="#{form.password.label}"></label> <label for="password" th:text="#{form.password.label}"></label>
<th:block <th:block
th:replace="~{gateway_fragments/input :: password(id = 'password', name = 'password', required = 'true', minlength = 5, maxlength = 257, enableToggle = true)}" th:replace="~{gateway_fragments/input :: password(id = 'password', name = 'password', required = 'true', minlength = 5, maxlength = 257, enableToggle = true)}"
></th:block> ></th:block>
<p class="alert alert-error" th:if="${#fields.hasErrors('password')}" th:errors="*{password}"></p> <p class="alert alert-error" th:if="${#fields.hasErrors('password')}" th:errors="*{password}"></p>
</div> </div>
@ -106,7 +106,7 @@
<div class="form-item"> <div class="form-item">
<label for="confirmPassword" th:text="#{form.confirmPassword.label}"></label> <label for="confirmPassword" th:text="#{form.confirmPassword.label}"></label>
<th:block <th:block
th:replace="~{gateway_fragments/input :: password(id = 'confirmPassword', name = 'confirmPassword', required = 'true', minlength = 5, maxlength = 257, enableToggle = true)}" th:replace="~{gateway_fragments/input :: password(id = 'confirmPassword', name = 'confirmPassword', required = 'true', minlength = 5, maxlength = 257, enableToggle = true)}"
></th:block> ></th:block>
<p class="alert alert-error" th:if="${#fields.hasErrors('confirmPassword')}" th:errors="*{confirmPassword}"></p> <p class="alert alert-error" th:if="${#fields.hasErrors('confirmPassword')}" th:errors="*{confirmPassword}"></p>
</div> </div>
@ -128,7 +128,7 @@
const email = document.getElementById("email").value; const email = document.getElementById("email").value;
if (!email) { if (!email) {
throw new Error(/*[[#{form.signup.emailCode.send.emptyValidation}]]*/""); throw new Error(/*[[#{form.emailCode.send.emptyValidation}]]*/"");
} }
fetch("/signup/send-email-code", { fetch("/signup/send-email-code", {