Fix password validation error messages (#34030)
Closes #33987 Signed-off-by: SebastEnn <103125747+SebastEnn@users.noreply.github.com>
This commit is contained in:
parent
c5d26bd45d
commit
ece97f3a41
1 changed files with 4 additions and 3 deletions
|
@ -63,8 +63,6 @@
|
|||
<script type="module">
|
||||
import { validatePassword } from "${url.resourcesPath}/js/password-policy.js";
|
||||
|
||||
const template = document.querySelector("#errorTemplate").content.cloneNode(true);
|
||||
|
||||
const activePolicies = [
|
||||
{ name: "length", policy: { value: ${passwordPolicies.length!-1}, error: "${msg('invalidPasswordMinLengthMessage')}"} },
|
||||
{ name: "maxLength", policy: { value: ${passwordPolicies.maxLength!-1}, error: "${msg('invalidPasswordMaxLengthMessage')}"} },
|
||||
|
@ -79,6 +77,9 @@
|
|||
if (serverErrors) {
|
||||
serverErrors.remove();
|
||||
}
|
||||
|
||||
const template = document.querySelector("#errorTemplate").content.cloneNode(true);
|
||||
|
||||
const errors = validatePassword(event.target.value, activePolicies);
|
||||
const errorList = template.querySelector("ul");
|
||||
const htmlErrors = errors.forEach((e) => {
|
||||
|
@ -87,7 +88,7 @@
|
|||
li.textContent = e;
|
||||
errorList.appendChild(li);
|
||||
});
|
||||
document.getElementById("input-error-client-password").appendChild(template);
|
||||
document.getElementById("input-error-client-password").replaceChildren(template);
|
||||
});
|
||||
</script>
|
||||
</#if>
|
||||
|
|
Loading…
Reference in a new issue