big restructure
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { warnOnce } from '../core/app-dom.js';
|
||||
|
||||
const rules = {
|
||||
min: (value, min) => value.length >= min,
|
||||
upper: (value) => /[A-Z]/.test(value),
|
||||
@@ -25,6 +27,15 @@ export function initPasswordHints() {
|
||||
const passwordInput = passwordSelector ? document.querySelector(passwordSelector) : null;
|
||||
const confirmInput = confirmSelector ? document.querySelector(confirmSelector) : null;
|
||||
const emailInput = emailSelector ? document.querySelector(emailSelector) : null;
|
||||
if (passwordSelector && !passwordInput) {
|
||||
warnOnce('UI_EL_MISSING', `Missing password input: ${passwordSelector}`, { module: 'password-hints' });
|
||||
}
|
||||
if (confirmSelector && !confirmInput) {
|
||||
warnOnce('UI_EL_MISSING', `Missing confirm input: ${confirmSelector}`, { module: 'password-hints' });
|
||||
}
|
||||
if (emailSelector && !emailInput) {
|
||||
warnOnce('UI_EL_MISSING', `Missing email input: ${emailSelector}`, { module: 'password-hints' });
|
||||
}
|
||||
const minLength = Number.parseInt(container.dataset.minLength || '12', 10);
|
||||
const items = container.querySelectorAll('[data-rule]');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user