UNPKG

phantomauth

Version:

An authentication library with built-in security features, designed for fast and boilerplate-free backend development. Ideal for quickly building MVPs with a reasonable level of security. Not intended for high-risk or enterprise level use.

10 lines (9 loc) 408 B
export const validatePass = (password) => { const passRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[\W_]).{8,}$/; const invalidPass = !passRegex.test(password); if(invalidPass) { const error = new Error('Password must be at least 8 characters long and include an uppercase letter, a lowercase letter, a number, and a special character.'); error.status = 400; throw error; } }