diff --git a/application/src/main/resources/static/js/main.js b/application/src/main/resources/static/js/main.js index 727b25abf..241caa097 100644 --- a/application/src/main/resources/static/js/main.js +++ b/application/src/main/resources/static/js/main.js @@ -151,3 +151,19 @@ document.addEventListener("DOMContentLoaded", () => { } }); }); + +function setupPasswordConfirmation(passwordId, confirmPasswordId) { + const password = document.getElementById(passwordId); + const confirmPassword = document.getElementById(confirmPasswordId); + + function validatePasswordMatch() { + if (password.value !== confirmPassword.value) { + confirmPassword.setCustomValidity(i18nResources.passwordConfirmationFailed); + } else { + confirmPassword.setCustomValidity(""); + } + } + + password.addEventListener("change", validatePasswordMatch); + confirmPassword.addEventListener("input", validatePasswordMatch); +} diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments.html b/application/src/main/resources/templates/gateway_modules/common_fragments.html index ba19048ce..d434cd39d 100644 --- a/application/src/main/resources/templates/gateway_modules/common_fragments.html +++ b/application/src/main/resources/templates/gateway_modules/common_fragments.html @@ -8,6 +8,7 @@ const i18nResources = { sendVerificationCodeSuccess: `[(#{js.sendVerificationCode.success})]`, sendVerificationCodeFailed: `[(#{js.sendVerificationCode.failed})]`, + passwordConfirmationFailed: `[(#{js.passwordConfirmation.failed})]` }; diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments.properties b/application/src/main/resources/templates/gateway_modules/common_fragments.properties index 20c55fde0..22053bc75 100644 --- a/application/src/main/resources/templates/gateway_modules/common_fragments.properties +++ b/application/src/main/resources/templates/gateway_modules/common_fragments.properties @@ -1,6 +1,7 @@ socialLogin.label=社交登录 js.sendVerificationCode.success=发送成功 js.sendVerificationCode.failed=发送失败,请稍后再试 +js.passwordConfirmation.failed=确认密码不匹配 signupNotice.description=没有账号? signupNotice.link=立即注册 diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments_en.properties b/application/src/main/resources/templates/gateway_modules/common_fragments_en.properties index 8b8a620e2..70af7ab8d 100644 --- a/application/src/main/resources/templates/gateway_modules/common_fragments_en.properties +++ b/application/src/main/resources/templates/gateway_modules/common_fragments_en.properties @@ -1,6 +1,7 @@ socialLogin.label=Social Login js.sendVerificationCode.success=Sent Successfully js.sendVerificationCode.failed=Sending Failed, Please Try Again Later +js.passwordConfirmation.failed=Password confirmation does not match signupNotice.description=Don't have an account? signupNotice.link=Sign up diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments_es.properties b/application/src/main/resources/templates/gateway_modules/common_fragments_es.properties index 00349a8bf..db6c8cef4 100644 --- a/application/src/main/resources/templates/gateway_modules/common_fragments_es.properties +++ b/application/src/main/resources/templates/gateway_modules/common_fragments_es.properties @@ -1,6 +1,7 @@ socialLogin.label=Inicio de Sesión Social js.sendVerificationCode.success=Enviado con éxito js.sendVerificationCode.failed=Error al enviar, por favor intente nuevamente más tarde +js.passwordConfirmation.failed=La confirmación de la contraseña no coincide signupNotice.description=¿No tienes una cuenta? signupNotice.link=Regístrate ahora diff --git a/application/src/main/resources/templates/gateway_modules/common_fragments_zh_TW.properties b/application/src/main/resources/templates/gateway_modules/common_fragments_zh_TW.properties index d86fbc733..63129e166 100644 --- a/application/src/main/resources/templates/gateway_modules/common_fragments_zh_TW.properties +++ b/application/src/main/resources/templates/gateway_modules/common_fragments_zh_TW.properties @@ -1,6 +1,7 @@ socialLogin.label=社交登入 js.sendVerificationCode.success=發送成功 js.sendVerificationCode.failed=發送失敗,請稍後再試 +js.passwordConfirmation.failed=確認密碼不匹配 signupNotice.description=沒有帳號? signupNotice.link=立即註冊 diff --git a/application/src/main/resources/templates/gateway_modules/form_fragments.html b/application/src/main/resources/templates/gateway_modules/form_fragments.html index 133d2b52f..641943a95 100644 --- a/application/src/main/resources/templates/gateway_modules/form_fragments.html +++ b/application/src/main/resources/templates/gateway_modules/form_fragments.html @@ -153,19 +153,7 @@ @@ -269,6 +257,12 @@