andre 2 سال پیش
والد
کامیت
4f18c68e2a
2فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 2 2
      api/KerioWhmcs.php
  2. 4 2
      app/UI/Client/EmailAccount/Providers/AccountDataProvider.php

+ 2 - 2
api/KerioWhmcs.php

@@ -465,13 +465,13 @@ class KerioWhmcs extends KerioConnectApi {
 	 * @param	string	Password
 	 * @return	array	Result
 	 */
-	function createUser($domain, $username, $password) {
+	function createUser($domain, $username, $password, $active = TRUE) {
 		$params = array(
 			'users' => array(array(
 				'loginName' => $username,
 				'password' => $password,
 				'domainId' => $domain,
-				'isEnabled' => TRUE
+				'isEnabled' => $active
 			))
 		);
 		$result = $this->sendRequest('Users.create', $params);

+ 4 - 2
app/UI/Client/EmailAccount/Providers/AccountDataProvider.php

@@ -16,6 +16,7 @@ use ThurData\Servers\KerioEmail\Core\Http\JsonResponse;
 use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
 use ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\DataProviders\BaseDataProvider;
+use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
 
 /**
  *
@@ -36,7 +37,7 @@ class AccountDataProvider extends BaseDataProvider
         $hid = $this->request->get('id');
         $hosting = Hosting::where('id', $hid)->first();
         $this->data['domain'] = $this->getWhmcsParamByKey('customfields')['maildomain'];
-        
+
         $lang = di('lang');
         $this->availableValues['status'] = [
             Kerio::ACC_STATUS_ACTIVE        => $lang->absoluteT('kerio','account','status','active'),
@@ -87,8 +88,9 @@ class AccountDataProvider extends BaseDataProvider
         if ($domainID === FALSE) {
             return "Error: Domain $maildomain not found";
         }
+        $active = $this->formData['status'] === 'active' ? TRUE : FALSE;
         try {
-            $userID = $api->createUser($domainID, $this->formData['username'], $this->formData['password']);
+            $userID = $api->createUser($domainID, $this->formData['username'], $this->formData['password'], $active);
         } catch (KerioApiException $error) {
             logModuleCall(
                 'kerioEmail',