Florian Schaal
2016-02-25 d83abe0860e13d599b34e7e150e4ba2fd571db93
interface/lib/classes/validate_password.inc.php
@@ -33,24 +33,34 @@
   
   private function _get_password_strength($password) {
      $length = strlen($password);
      $points = 0;
      if ($length < 5) {
         return 1;
      }
      $different = 0;
      if (preg_match('/[abcdefghijklnmopqrstuvwxyz]/', $password)) {
         $different += 1;
      }
      if (preg_match('/[ABCDEFGHIJKLNMOPQRSTUVWXYZ]/', $password)) {
         $points += 1;
         $different += 1;
      }
      if (preg_match('/[0123456789]/', $password)) {
         $points += 1;
         $different += 1;
      }
      if (preg_match('/[`~!@#$%^&*()_+|\\=-[]}{\';:\/?.>,<" ]/', $password)) {
      if (preg_match('/[`~!@#$%^&*()_+|\\=\-\[\]}{\';:\/?.>,<" ]/', $password)) {
         $points += 1;
         $different += 1;
      }
      if ($points == 0) {
      if ($points == 0 || $different < 3) {
         if ($length >= 5 && $length <= 6) {
            return 1;
         } else if ($length >= 7 && $length <= 8) {
@@ -114,7 +124,7 @@
         $lng_text = str_replace('{chars}', $min_password_length, $lng_text);
      }
      if(!$lng_text) $lng_text = 'weak_password_txt'; // always return a string, even if language is missing - otherwise validator is NOT MATCHING!
      if(strlen($field_value) < $min_password_length) return $lng_text;
      if($this->_get_password_strength($field_value) < $min_password_strength) return $lng_text;