Jelajahi Sumber

edit Account

andre 2 tahun lalu
induk
melakukan
b2a17d298b

+ 27 - 8
app/UI/Client/EmailAccount/Providers/EditAccountDataProvider.php

@@ -275,14 +275,33 @@ class EditAccountDataProvider extends BaseDataProvider
          */
         $productManager = new ProductManager();
         $productManager->loadByHostingId($hid);
-
-        logModuleCall(
-            'kerioEmail',
-            __FUNCTION__,
-            $this->formData,
-            'Debug Error',
-            $hid
-        );
+        $fields['password'] = $this->formData['password'];
+        $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'], $fields);
+        } catch (KerioApiException $error) {
+            logModuleCall(
+                'kerioEmail',
+                __FUNCTION__,
+                $error,
+                'Debug Error',
+                $error->getMessage()
+            );
+            return ['error' => $error->getMessage()];
+        }
+        $api->logout();
 
         return (new HtmlDataJsonResponse())->setMessageAndTranslate('passwordChangedSuccessfully')->setStatusSuccess();
     }