check password policy for random passwords and allow "$" in postalAddress
This commit is contained in:
		
							parent
							
								
									f2f52cc9c8
								
							
						
					
					
						commit
						df6723edd2
					
				|  | @ -287,9 +287,20 @@ function pwd_is_enabled($hash) { | ||||||
| function generateRandomPassword() { | function generateRandomPassword() { | ||||||
| 	$list = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_'; | 	$list = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_'; | ||||||
| 	$password = ''; | 	$password = ''; | ||||||
| 	for ($i = 0; $i < 12; $i++) { | 	$length = $_SESSION['cfgMain']->passwordMinLength; | ||||||
| 		$rand = $_SESSION['ldap']->new_rand() % 65; | 	if ($length < 12) { | ||||||
| 		$password .= $list[$rand]; | 		$length = 12; | ||||||
|  | 	} | ||||||
|  | 	$isOk = false; | ||||||
|  | 	for ($x = 0; $x < 10000; $x++) { | ||||||
|  | 		$password = ''; | ||||||
|  | 		for ($i = 0; $i < $length; $i++) { | ||||||
|  | 			$rand = $_SESSION['ldap']->new_rand() % 65; | ||||||
|  | 			$password .= $list[$rand]; | ||||||
|  | 		} | ||||||
|  | 		if (checkPasswordStrength($password) === true) { | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	return $password; | 	return $password; | ||||||
| } | } | ||||||
|  | @ -405,8 +416,10 @@ function get_preg($argument, $regexp) { | ||||||
| 		case "mailLocalAddress": | 		case "mailLocalAddress": | ||||||
| 					$pregexpr = '/^([0-9a-zA-Z+\\/\\._-])+([@]([0-9a-zA-Z-])+([.]([0-9a-zA-Z-])+)*)?$/'; | 					$pregexpr = '/^([0-9a-zA-Z+\\/\\._-])+([@]([0-9a-zA-Z-])+([.]([0-9a-zA-Z-])+)*)?$/'; | ||||||
| 					break; | 					break; | ||||||
| 		case "postalAddress":	// Allow all but \, <, >, =, $, ?
 | 		case "postalAddress":	// Allow all but \, <, >, =, ?
 | ||||||
| 		case "postalCode": | 					$pregexpr = '/^[^\\\<>=\\?]*$/'; | ||||||
|  | 					break; | ||||||
|  | 		case "postalCode":	// Allow all but \, <, >, =, ?
 | ||||||
| 		case "street": | 		case "street": | ||||||
| 		case "title": | 		case "title": | ||||||
| 		case "employeeType": | 		case "employeeType": | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue