translate AD password policy error

This commit is contained in:
Roland Gruber 2014-02-27 20:50:57 +00:00
parent 01719b9899
commit 5cc16a6957
2 changed files with 12 additions and 3 deletions

View File

@ -1196,12 +1196,16 @@ function getExtendedLDAPErrorMessage($server) {
* @return String error message * @return String error message
*/ */
function getDefaultLDAPErrorString($server) { function getDefaultLDAPErrorString($server) {
$extError = getExtendedLDAPErrorMessage($server); $extError = htmlspecialchars(getExtendedLDAPErrorMessage($server));
// Active Directory message translations
if ((strpos($extError, 'DSID-031A120C') !== false) && (strpos($extError, '5003') !== false)) {
$extError = _('Your password does not meet the password strength qualifications. Please retry with another one.') . '<br><br>' . $extError;
}
$message = _('LDAP error, server says:') . ' ' . ldap_error($server); $message = _('LDAP error, server says:') . ' ' . ldap_error($server);
if (!empty($extError)) { if (!empty($extError)) {
$message .= ' - ' . $extError; $message .= ' - ' . $extError;
} }
return htmlspecialchars($message); return $message;
} }
/** /**

View File

@ -1890,8 +1890,13 @@ class windowsUser extends baseModule implements passwordService {
fclose($pipes[1]); fclose($pipes[1]);
$returnCode = proc_close($process); $returnCode = proc_close($process);
if ($returnCode != 0) { if ($returnCode != 0) {
$outputMessages = htmlspecialchars($outputMessages);
// Active Directory message translations
if ((strpos($outputMessages, 'DSID-03190F80') !== false) && (strpos($outputMessages, 'unicodePwd') !== false)) {
$outputMessages = _('Your password does not meet the password strength qualifications. Please retry with another one.') . '<br><br>' . $outputMessages;
}
logNewMessage(LOG_ERR, 'Changing user password failed: ' . $outputMessages); logNewMessage(LOG_ERR, 'Changing user password failed: ' . $outputMessages);
$return['messages'][] = array('ERROR', _('Unable to change password.'), htmlspecialchars($outputMessages)); $return['messages'][] = array('ERROR', _('Unable to change password.'), $outputMessages);
return; return;
} }
else { else {