loreal-sla-calculator/server/utils/validators.js
2026-03-13 10:52:07 +00:00

17 lines
538 B
JavaScript
Executable file

'use strict';
function isLorealEmail(email) {
if (typeof email !== 'string') return false;
return /^[^\s@]+@loreal\.com$/i.test(email.trim());
}
// Minimum 8 chars, at least one uppercase, one lowercase, one digit
function isStrongPassword(password) {
if (typeof password !== 'string' || password.length < 8) return false;
if (!/[A-Z]/.test(password)) return false;
if (!/[a-z]/.test(password)) return false;
if (!/[0-9]/.test(password)) return false;
return true;
}
module.exports = { isLorealEmail, isStrongPassword };