fx-1 / src /lib /auth.ts
felix-fx's picture
Initial commit from GitHub fx-1
6711fd5 verified
Raw History Blame Contribute Delete
653 Bytes
/**
* Auth utility - uses Supabase Auth exclusively
* Legacy custom encryption removed
*/
export function checkPasswordStrength(password: string): { score: number; feedback: string } {
let score = 0;
if (!password) return { score: 0, feedback: "فارغة" };
if (password.length >= 8) score++;
if (/[A-Z]/.test(password)) score++;
if (/[a-z]/.test(password)) score++;
if (/[0-9]/.test(password)) score++;
if (/[^A-Za-z0-9]/.test(password)) score++;
let feedback = "";
if (score < 3) feedback = "ضعيفة";
else if (score < 5) feedback = "متوسطة";
else feedback = "قوية جداً";
return { score, feedback };
}