Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Provisioning Module issue: ServiceSingleSignOn hook is not working as expected #151

Open
stejas123 opened this issue Sep 5, 2019 · 0 comments

Comments

@stejas123
Copy link

stejas123 commented Sep 5, 2019

SeviceSingleSignOn Core module function not redirecting on new tab.

Instead of its printing the variable in the same tab.

code :

function myModule_ServiceSingleSignOn(array $params) {
    $return = array(
		'success' => false,
	);
    try {
        if($params['domain'] == ''){
            throw new Exception('domain cannot be blank');
            return false;
         }
        // Call the service's single sign-on token retrieval function, using the
        // values provided by WHMCS in $params.
        $data = [
            'customerId'=> $params['clientsdetails']['userid'],
            'domainName'=> $params['domain'],
            'orderId'=> strval($params['serviceid']),
            'exp'=> time()+60*5

        ];
        $token = generateJWT($data , $params['serverpassword']);
        $controlPanelUrl = constant('CONTROL_PANEL_PATH');
        return array(
            'success' => true,
            'redirectTo' => $controlPanelUrl.'?partnerId='.$params["serverusername"].'&jwt='.$token
        );
    } catch (Exception $e) {
        // Record the error in WHMCS's module log.
        logModuleCall(
            'flockcloudmodule',
            __FUNCTION__,
            $params,
            $e->getMessage(),
            $e->getTraceAsString()
        );

        return array(
            'success' => false,
            'errorMsg' => $e->getMessage(),
        );
    }
}

Output
Screen Shot 2019-09-05 at 1 44 33 PM

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant