From bcff25544181b6a100e9ef36d5ee9e8313b5d01a Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 6 Feb 2014 17:34:56 +0000 Subject: [PATCH] earlier check for duplicate user names --- lam/lib/modules/posixAccount.inc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 446d2ab2..975d114d 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -1318,6 +1318,14 @@ class posixAccount extends baseModule implements passwordService { // fill default value for user ID with first/last name $attrs = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes(); $this->attributes['uid'][0] = $this->getUserNameSuggestion($attrs); + if (!empty($this->attributes['uid'][0]) && $this->userNameExists($this->attributes['uid'][0])) { + while ($this->userNameExists($this->attributes['uid'][0])) { + $this->attributes['uid'][0] = $this->getNextUserName($this->attributes['uid'][0]); + } + $msg = new htmlStatusMessage($this->messages['uid'][5][0], $this->messages['uid'][5][1], $this->messages['uid'][5][2]); + $msg->colspan = 10; + $return->addElement($msg, true); + } } elseif ($this->getAccountContainer()->getAccountModule('windowsUser') != null) { // fill default value for user ID with AD user name @@ -2855,11 +2863,6 @@ class posixAccount extends baseModule implements passwordService { } $format = str_replace(array_keys($this->umlautReplacements), array_values($this->umlautReplacements), strtolower($format)); $format = str_replace(array(' ', '_', '-'), array('', '', ''), $format); - if (!empty($format) && $this->userNameExists($format)) { - while ($this->userNameExists($format)) { - $format = $this->getNextUserName($format); - } - } return $format; }