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">
|
<script type="module">
|
||||||
import { validatePassword } from "${url.resourcesPath}/js/password-policy.js";
|
import { validatePassword } from "${url.resourcesPath}/js/password-policy.js";
|
||||||
|
|
||||||
const template = document.querySelector("#errorTemplate").content.cloneNode(true);
|
|
||||||
|
|
||||||
const activePolicies = [
|
const activePolicies = [
|
||||||
{ name: "length", policy: { value: ${passwordPolicies.length!-1}, error: "${msg('invalidPasswordMinLengthMessage')}"} },
|
{ name: "length", policy: { value: ${passwordPolicies.length!-1}, error: "${msg('invalidPasswordMinLengthMessage')}"} },
|
||||||
{ name: "maxLength", policy: { value: ${passwordPolicies.maxLength!-1}, error: "${msg('invalidPasswordMaxLengthMessage')}"} },
|
{ name: "maxLength", policy: { value: ${passwordPolicies.maxLength!-1}, error: "${msg('invalidPasswordMaxLengthMessage')}"} },
|
||||||
|
@ -79,6 +77,9 @@
|
||||||
if (serverErrors) {
|
if (serverErrors) {
|
||||||
serverErrors.remove();
|
serverErrors.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const template = document.querySelector("#errorTemplate").content.cloneNode(true);
|
||||||
|
|
||||||
const errors = validatePassword(event.target.value, activePolicies);
|
const errors = validatePassword(event.target.value, activePolicies);
|
||||||
const errorList = template.querySelector("ul");
|
const errorList = template.querySelector("ul");
|
||||||
const htmlErrors = errors.forEach((e) => {
|
const htmlErrors = errors.forEach((e) => {
|
||||||
|
@ -87,7 +88,7 @@
|
||||||
li.textContent = e;
|
li.textContent = e;
|
||||||
errorList.appendChild(li);
|
errorList.appendChild(li);
|
||||||
});
|
});
|
||||||
document.getElementById("input-error-client-password").appendChild(template);
|
document.getElementById("input-error-client-password").replaceChildren(template);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
Loading…
Reference in a new issue