mirror of https://github.com/halo-dev/halo
fix: JavaScript error on signup page (#6788)
#### What type of PR is this? /area core /kind bug /milestone 2.20.x #### What this PR does / why we need it: 修复注册页面的 JS 错误。 #### Does this PR introduce a user-facing change? ```release-note None ```pull/6797/head
parent
c39f937b5b
commit
2555cbf6ff
|
@ -152,13 +152,31 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
var password = document.getElementById("password"),
|
||||||
|
confirm_password = document.getElementById("confirmPassword");
|
||||||
|
|
||||||
|
function validatePassword() {
|
||||||
|
if (password.value != confirm_password.value) {
|
||||||
|
confirm_password.setCustomValidity("Passwords Don't Match");
|
||||||
|
} else {
|
||||||
|
confirm_password.setCustomValidity("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
password.onchange = validatePassword;
|
||||||
|
confirm_password.onkeyup = validatePassword;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:if="${globalInfo.mustVerifyEmailOnRegistration}" th:inline="javascript">
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
function sendRequest() {
|
function sendRequest() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
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.signup.emailCode.send.emptyValidation}]]*/"");
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch("/signup/send-email-code", {
|
fetch("/signup/send-email-code", {
|
||||||
|
@ -183,20 +201,6 @@
|
||||||
|
|
||||||
const emailCodeSendButton = document.getElementById("emailCodeSendButton");
|
const emailCodeSendButton = document.getElementById("emailCodeSendButton");
|
||||||
sendVerificationCode(emailCodeSendButton, sendRequest);
|
sendVerificationCode(emailCodeSendButton, sendRequest);
|
||||||
|
|
||||||
var password = document.getElementById("password"),
|
|
||||||
confirm_password = document.getElementById("confirmPassword");
|
|
||||||
|
|
||||||
function validatePassword() {
|
|
||||||
if (password.value != confirm_password.value) {
|
|
||||||
confirm_password.setCustomValidity("Passwords Don't Match");
|
|
||||||
} else {
|
|
||||||
confirm_password.setCustomValidity("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
password.onchange = validatePassword;
|
|
||||||
confirm_password.onkeyup = validatePassword;
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue