MCPcopy
hub / github.com/MacRimi/ProxMenux / validatePasswordStrength

Function validatePasswordStrength

AppImage/components/security.tsx:48–65  ·  view source on GitHub ↗
(pw: string)

Source from the content-addressed store, hash-verified

46 "changeme", "abcdefgh",
47])
48function validatePasswordStrength(pw: string): string | null {
49 if (pw.length < 10) {
50 return "Password must be at least 10 characters"
51 }
52 const categories = [
53 /[a-z]/.test(pw),
54 /[A-Z]/.test(pw),
55 /\d/.test(pw),
56 /[^A-Za-z0-9]/.test(pw),
57 ].filter(Boolean).length
58 if (categories < 3) {
59 return "Password must mix at least 3 of: lowercase, uppercase, digits, symbols"
60 }
61 if (_OBVIOUS_PASSWORDS.has(pw.toLowerCase())) {
62 return "That password is in the common-passwords list — pick something else"
63 }
64 return null
65}
66
67export function Security() {
68 const [authEnabled, setAuthEnabled] = useState(false)

Callers 2

handleEnableAuthFunction · 0.85
handleChangePasswordFunction · 0.85

Calls 2

filterMethod · 0.80
testMethod · 0.45

Tested by

no test coverage detected