@@ 772-786 (lines=15) @@ | ||
769 | $salt = ''; |
|
770 | ||
771 | if (!empty($_configuration['password_encryption'])) { |
|
772 | if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
773 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
|
774 | $msg = "Encryption $encrypt_method is invalid"; |
|
775 | $results[] = $msg; |
|
776 | continue; |
|
777 | } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
|
778 | $msg = "Encryption $encrypt_method is invalid"; |
|
779 | $results[] = $msg; |
|
780 | continue; |
|
781 | } |
|
782 | } else { |
|
783 | $msg = "This encryption $encrypt_method is not configured"; |
|
784 | $results[] = $msg; |
|
785 | continue; |
|
786 | } |
|
787 | } else { |
|
788 | $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured'; |
|
789 | $results[] = $msg; |
|
@@ 2259-2273 (lines=15) @@ | ||
2256 | ||
2257 | $password = $user_param['password']; |
|
2258 | $encrypt_method = $user_param['encrypt_method']; |
|
2259 | if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
2260 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
|
2261 | $msg = "Encryption $encrypt_method is invalid"; |
|
2262 | $results[] = $msg; |
|
2263 | continue; |
|
2264 | } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
|
2265 | $msg = "Encryption $encrypt_method is invalid"; |
|
2266 | $results[] = $msg; |
|
2267 | continue; |
|
2268 | } |
|
2269 | } else { |
|
2270 | $msg = "This encryption $encrypt_method is not configured"; |
|
2271 | $results[] = $msg; |
|
2272 | continue; |
|
2273 | } |
|
2274 | } elseif (!empty($user_param['password']) && empty($user_param['encrypt_method'])){ |
|
2275 | $msg = "If password is not empty the encrypt_method param is required "; |
|
2276 | $results[] = $msg; |