Ejemplo n.º 1
0
function hook_oneportalcloud_ChangePassword($params)
{
    if (isset($_POST['ac'])) {
        return 'success';
    }
    $params = $params['params'];
    if ($params['moduletype'] != 'oneportalcloud') {
        return 'success';
    }
    $op = new OnePortalCloud($params['configoption1'], $params['configoption2'], $params['configoption3']);
    $server_id = $params['customfields']['Server ID'];
    if (empty($server_id)) {
        return 'Unable to determine Server ID to suspend';
    }
    if (substr(strtoupper($server_id), 0, 3) != 'LSN') {
        $server_id = 'LSN-' . $server_id;
    }
    $ret = $op->changePassword($server_id, $params['password']);
    if (!$ret->error) {
        $res = 'success';
    } else {
        $res = $ret->error;
    }
    return $res;
}
Ejemplo n.º 2
0
function oneportalcloud_ChangePassword($params)
{
    if (!isset($_POST['ac'])) {
        return 'success';
    }
    $op = new OnePortalCloud($params['configoption1'], $params['configoption2'], $params['configoption3']);
    $server_id = $params['customfields']['Server ID'];
    if (empty($server_id)) {
        return 'Unable to determine Server ID to suspend';
    }
    if (substr(strtoupper($server_id), 0, 3) != 'LSN') {
        $server_id = 'LSN-' . $server_id;
    }
    $ret = $op->changePassword($server_id, $_POST['ac']);
    if (!$ret->error) {
        include '../../../configuration.php';
        # Path to WHMCS configuration file. If change password does not work then make sure this is correct
        $where = array('id' => $params['serviceid']);
        update_query('tblhosting', array('password' => encrypt($_POST['ac'], $cc_encryption_hash)), $where);
        $res = 'success';
    } else {
        $res = $ret->error;
    }
    return $res;
}