new login consistency constraint added (no more than 2 consecutive same char or digits)
[brisk.git] / web / Obj / brisk.phh
index f971277..e3abaa9 100644 (file)
@@ -3540,6 +3540,9 @@ function carousel_top()
     }
 }
 
+/* function login_consistency:
+       name length must be less or equal than 12 chars,
+       no more than 2 consecutive same character (or generic digits) are allowed */
 function login_consistency($name)
 {
     $old_c = '';
@@ -3550,6 +3553,9 @@ function login_consistency($name)
     for ($i = 0 ; $i < mb_strlen($name) ; $i++) {
         $c = mb_substr($name, $i, 1);
         if (mb_ereg_match ("[a-zA-Z0-9]", $c)) {
+            if (mb_ereg_match ("[0-9]", $c)) {
+                $c = "0";
+            }
             if ($old_c != $c) {
                 $old_c = $c;
                 $old_ct = 1;