|
|
@@ -499,13 +499,25 @@ function zimbraSingle_CreateAccount($params)
|
|
|
'zimbrasingle',
|
|
|
__FUNCTION__,
|
|
|
$accessData,
|
|
|
- "Error : cannot login to " . $accessData['zimbraServer'],
|
|
|
+ "Error: cannot login to " . $accessData['zimbraServer'],
|
|
|
$login->getMessage()
|
|
|
);
|
|
|
- return "Error : cannot login to " . $accessData['zimbraServer'];
|
|
|
- } else {
|
|
|
- $apiAccountManager = new Zm_Account($api);
|
|
|
- if( $apiAccountManager->accountExists($account_name)) {
|
|
|
+ return "Error: cannot login to " . $accessData['zimbraServer'];
|
|
|
+ }
|
|
|
+ $account_name = $params['customfields']['username'] . '@' . $params['customfields']['maildomain'];
|
|
|
+ $apiAccountManager = new Zm_Account($api);
|
|
|
+ $accountExists = $apiAccountManager->accountExists($account_name);
|
|
|
+ if(is_a($accountExists, "Exception")) {
|
|
|
+ logModuleCall(
|
|
|
+ 'zimbrasingle',
|
|
|
+ __FUNCTION__,
|
|
|
+ $accessData,
|
|
|
+ "Error: could not verify $account_name",
|
|
|
+ $accountExists
|
|
|
+ );
|
|
|
+ return "Error: could not verify $account_name";
|
|
|
+ }
|
|
|
+ if($accountExists === true) {
|
|
|
return "Error: account $account_name already exists";
|
|
|
} else {
|
|
|
return "Error: account $account_name not exists";
|
|
|
@@ -528,7 +540,6 @@ function zimbraSingle_CreateAccount($params)
|
|
|
);
|
|
|
return "Error: could not decrypt password";
|
|
|
}
|
|
|
- $account_name = $params['customfields']['username'] . '@' . $params['customfields']['maildomain'];
|
|
|
$cosID = $apiAccountManager->getCosId($params['customfields']['cos']);
|
|
|
if(is_a($cosID, "Exception")) {
|
|
|
logModuleCall(
|