File size: 653 Bytes
6711fd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * 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 };
}