universal_authentication
Version:
Seamless and Secure Authentication for Modern Web Applications: Easily integrate OTP-based email verification, Google OAuth, GitHub, Microsoft, and Okta login into your Node.js app. Modular, flexible, and database-agnostic, this package simplifies user au
16 lines (15 loc) • 675 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.validatePassword = exports.validateEmail = exports.passwordRegex = exports.emailRegex = void 0;
exports.emailRegex = /^[^\d][^\s@]*\d[^\s@]*@[^\s@]+\.[^\s@]+$/;
exports.passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[\S]{12,}$/;
// Function to validate the email format
const validateEmail = (email) => {
return exports.emailRegex.test(email);
};
exports.validateEmail = validateEmail;
// Function to validate the password strength
const validatePassword = (password) => {
return exports.passwordRegex.test(password);
};
exports.validatePassword = validatePassword;
;