Browse Source

add Account

andre 2 years ago
parent
commit
475e7de256
1 changed files with 9 additions and 10 deletions
  1. 9 10
      app/UI/Client/EmailAccount/Providers/AccountDataProvider.php

+ 9 - 10
app/UI/Client/EmailAccount/Providers/AccountDataProvider.php

@@ -73,7 +73,7 @@ class AccountDataProvider extends BaseDataProvider
         $maildomain = $this->getWhmcsParamByKey('customfields')['maildomain'];
         $maildomain = $this->getWhmcsParamByKey('customfields')['maildomain'];
         $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
         $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
         try {
         try {
-            $api->login($params['serverhostname'], $params['serverusername'], $params['serverpassword']);
+            $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
             $domainID = $api->getDomainId($maildomain);
             $domainID = $api->getDomainId($maildomain);
         } catch (KerioApiException $error) {
         } catch (KerioApiException $error) {
             logModuleCall(
             logModuleCall(
@@ -88,15 +88,6 @@ class AccountDataProvider extends BaseDataProvider
         if ($domainID === FALSE) {
         if ($domainID === FALSE) {
             return "Error: Domain $maildomain not found";
             return "Error: Domain $maildomain not found";
         }
         }
-
-        logModuleCall(
-            'kerioEmail',
-            __FUNCTION__,
-            $domainID,
-            'Debug Add Account',
-            $this->formData
-        );
-
         $active = $this->formData['status'] === 'active' ? TRUE : FALSE;
         $active = $this->formData['status'] === 'active' ? TRUE : FALSE;
         try {
         try {
             $userID = $api->createUser($domainID, $this->formData['username'], $this->formData['password'], $active);
             $userID = $api->createUser($domainID, $this->formData['username'], $this->formData['password'], $active);
@@ -111,6 +102,14 @@ class AccountDataProvider extends BaseDataProvider
             return ['error' => $error->getMessage()];
             return ['error' => $error->getMessage()];
         }             
         }             
 
 
+        logModuleCall(
+            'kerioEmail',
+            __FUNCTION__,
+            $domainID,
+            'Debug Add Account',
+            $userID
+        );
+
         $account['fullName'] = $this->formData['display_name'];
         $account['fullName'] = $this->formData['display_name'];
         if ($this->formData['quota'] > 0) {
         if ($this->formData['quota'] > 0) {
             $account['diskSizeLimit']['isActive'] = TRUE;
             $account['diskSizeLimit']['isActive'] = TRUE;