diff --git a/admin/inc/class.boaccounts.inc.php b/admin/inc/class.boaccounts.inc.php index ba33115697..51bf5762a8 100755 --- a/admin/inc/class.boaccounts.inc.php +++ b/admin/inc/class.boaccounts.inc.php @@ -682,6 +682,13 @@ } */ + if ($GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap' && + (!$_userData['account_lastname'] && !$_userData['lastname'])) + { + $error[$totalerrors] = lang('You must enter a lastname'); + $totalerrors++; + } + if (!$_userData['account_lid']) { $error[$totalerrors] = lang('You must enter a loginid'); diff --git a/phpgwapi/inc/class.accounts_ldap.inc.php b/phpgwapi/inc/class.accounts_ldap.inc.php index c011f7bb9c..c3727bb310 100644 --- a/phpgwapi/inc/class.accounts_ldap.inc.php +++ b/phpgwapi/inc/class.accounts_ldap.inc.php @@ -718,7 +718,7 @@ $entry['objectclass'][0] = 'top'; $entry['objectclass'][1] = 'posixGroup'; $entry['objectclass'][2] = 'phpgwAccount'; - $entry['cn'] = $account_info['account_lid']; + $entry['cn'] = utf8_encode($account_info['account_lid']); $entry['gidnumber'] = $account_id; $entry['userpassword'] = $GLOBALS['phpgw']->common->encrypt_password($account_info['account_passwd']); $entry['description'] = 'phpgw-created group'; @@ -726,9 +726,17 @@ else { $dn = 'uid=' . $account_info['account_lid'] . ',' . $this->user_context; - $entry['cn'] = sprintf("%s %s", $account_info['account_firstname'], $account_info['account_lastname']); - $entry['sn'] = $account_info['account_lastname']; - $entry['givenname'] = $account_info['account_firstname']; + + $entry['cn'] = utf8_encode(sprintf("%s %s", + $account_info['account_firstname'], + $account_info['account_lastname'] + )); + + $entry['sn'] = utf8_encode($account_info['account_lastname']); + + if($account_info['account_firstname']) + $entry['givenname'] = utf8_encode($account_info['account_firstname']); + $entry['uid'] = $account_info['account_lid']; $entry['uidnumber'] = $account_id; if ($GLOBALS['phpgw_info']['server']['ldap_group_id']) @@ -756,7 +764,7 @@ ldap_add($this->ds, $dn, $entry); } - /* print ldap_error($this->ds); */ + // print ldap_error($this->ds); if($account_id && is_object($GLOBALS['phpgw']->preferences) && $default_prefs) {