loadByHostingId($this->request->get('id')); if ($this->getWhmcsParamByKey('status') !== 'Active' || !$productManager->isControllerAccessible(ControllerEnums::WEBMAIL_PAGE)) { return Helper\redirectByUrl(BuildUrlExtended::getProvisioningUrl('',false,false)); } $link = $productManager->get('login_link'); if(!$link) { $link = $productManager->getClientUrl(); } return Helper\redirectByUrl($link, []); } /** * @throws \Exception */ public function clientSso() { /** * * product managet */ $productManager = new ProductManager(); $productManager->loadByHostingId($this->request->get('id')); /** * * load API */ $api = (new ZimbraManager()) ->getApiByServer($productManager->getHosting()->server) ->soap; /** * * load sso service */ $sso = $api ->service() ->clientSingleSignOnToken() ->setFormData(['id' => $this->getRequestValue('actionElementId')]); /** * * run service */ $result = $sso->run(); /** * * throw error if without result */ if(!$result) { throw new \Exception($sso->getError()); } $url = $productManager->getClientUrl().'service/preauth'; return Helper\redirectByUrl($url, ['authtoken' => $result['authToken']]); } }