2 ms·
if (c.get().length < 8) C.isValid = !1, c.hasErrors = !0, c.errors = [{ message: "Password too short" }]; else if (c.get
by 0xmohit 10y ago
if (c.get().length < 8) C.isValid = !1, c.hasErrors = !0, c.errors = [{
message: "Password too short"
}];
else if (c.get().length > 256) C.isValid = !1, c.hasErrors = !0, c.errors = [{
message: "Password too long"
}];
else if (/^[a-zA-Z0-9`~!@#\$%^&*()_=+\[\]{};:'",.<>\/? -]*$/.test(c.get())) {
var e = 0;
/[a-z]/.test(c.get()) && (e += 1), /[A-Z]/.test(c.get()) && (e += 1), /[0-9]/.test(c.get()) && (e += 1), /[`~!@#\$%^&*()_=+\[\]{};:'",.<>\/? -]/.test(c.get()) && (e += 2), 3 > e ? (C.isValid = !1, c.hasErrors = !0, c.errors = [{
message: "Password too simple"
}]) : (c.hasErrors = !1, c.errors.length = 0)
} else C.isValid = !1, c.hasErrors = !0, c.errors = [{
message: "Invalid symbols in password"
}]
Maybe they could've used https://github.com/dropbox/zxcvbn https://github.com/dropbox/zxcvbn to determine password strength.