andre 2 лет назад
Родитель
Сommit
2b66cdc854
2 измененных файлов с 14 добавлено и 11 удалено
  1. 0 9
      api/KerioWhmcs.php
  2. 14 2
      app/UI/Client/EmailAccount/Providers/EditAccountDataProvider.php

+ 0 - 9
api/KerioWhmcs.php

@@ -490,15 +490,6 @@ class KerioWhmcs extends KerioConnectApi {
 			'userIds' => [ $userId ],
 			'pattern' => $attr
 		);
-
-		logModuleCall(
-			'kerioEmail',
-			__FUNCTION__,
-			$params,
-			'Debug Error',
-			$attr
-		);
-
 		$result = $this->sendRequest('Users.set', $params);
 		return $result;
 	}

+ 14 - 2
app/UI/Client/EmailAccount/Providers/EditAccountDataProvider.php

@@ -206,7 +206,7 @@ class EditAccountDataProvider extends BaseDataProvider
             );
             return ['error' => $error->getMessage()];
         }
-
+        $api->logout();
         return (new HtmlDataJsonResponse())->setMessageAndTranslate('emailAccountHasBeenUpdated')->setStatusSuccess();
     }
 
@@ -228,6 +228,18 @@ class EditAccountDataProvider extends BaseDataProvider
 
         $status['isEnabled'] = $this->formData['status'] === 'active' ? TRUE : FALSE;
         $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
+        try {
+            $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
+        } catch (KerioApiException $error) {
+            logModuleCall(
+                'kerioEmail',
+                __FUNCTION__,
+                $error,
+                'Debug Error',
+                $error->getMessage()
+            );
+            return ['error' => $error->getMessage()];
+        }
         try {
             $result = $api->modifyUser($this->formData['id'], $status);
         } catch (KerioApiException $error) {
@@ -240,7 +252,7 @@ class EditAccountDataProvider extends BaseDataProvider
             );
             return ['error' => $error->getMessage()];
         }
-
+        $api->logout();
         /**
          * return success
          */