Jump to content

cPanel Account Login


Recommended Posts

Hi @brian!

Yes it's working. Perfect as always, I replied back  via  'Messages'.  

Client has checked and we mentioned about you, client and us both thank you for all your help and support for his cause.  

 

---------------------

Can you please help me with a different issue 

(i) I installed a plugin 'EASY WHMCS Module' and I deleted some services / products in bulk some of them were being used by clients.

(ii) Now the clients does not have any services under their account 

(ii) They are still receiving their renewal emails even without the services / products under their account.

(iv) I can recreate all services / products manually and update their account with them but how do I stop the emails being sent out for the current non existent - services / products ( If I update the newly created products now our clients will receive all the new renewal emails along with the old ones which will create confusion) 

How do I handle this very confused...

Link to comment
Share on other sites

On 2/14/2020 at 9:25 PM, VirtualWorldGlobal said:

---------------------

Can you please help me with a different issue 

(i) I installed a plugin 'EASY WHMCS Module' and I deleted some services / products in bulk some of them were being used by clients.

(ii) Now the clients does not have any services under their account 

(ii) They are still receiving their renewal emails even without the services / products under their account.

(iv) I can recreate all services / products manually and update their account with them but how do I stop the emails being sent out for the current non existent - services / products ( If I update the newly created products now our clients will receive all the new renewal emails along with the old ones which will create confusion) 

How do I handle this very confused...

Hi

EASY WHMCS issue we faced is now resolved.  By chance is there a way to migrate invoices from one customer to another ?

Link to comment
Share on other sites

https://docs.whmcs.com/Products_Management

Quote

Invoices cannot be moved between clients, therefore when moving a product/service any invoices will remain under the old owner.

Therefore it would be advisable to check the old owner's Invoices tab for any unpaid invoices for this service and cancel them. If you wish to invoice the new owner for the service, move the Next Due Date forward/back by one day and a new invoice will be generated when the cron next runs.

Link to comment
Share on other sites

  • 2 weeks later...

---------------------------------------------------------

yes - but only with a hook, not from settings.

by default, any contact can see the list of all services on the My Services/Products page (possiibly that could be limited to "thier" product, but that's not simple...

it would be possible to assign access to each specific product details page to one or more contacts.

regards

Brian

---------------------------------------------------------

Please help on how to achieve this as I need to active for one client.

Thanks

 

 

 

Link to comment
Share on other sites

  • 4 months later...
On 2/6/2020 at 1:19 PM, brian! said:

<?php

# Primary Sidebar cPanel Login Form
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) {
	
	$client = Menu::context('client');
	$clientid = 4;
	if ($client->id == $clientid) {
		$service = Menu::context('service');    
		$servertype = $service->product->servertype;
		if ($servertype != ""){
			return;
		}
		$username = 'username';
		$password = 'password';
		$cpanelhref = 'https://www.domain.com:2083/login/';
		$webmailhref = 'https://www.domain.com:2096/login/';
		$bodyhtml = '<form method="post" action="'.$cpanelhref.'" target="_blank">
<input type="hidden" name="user" value ="'.$username.'"/>
<input type="hidden" name="pass" value ="'.$password.'"/>
<input class="btn btn-success btn-sm btn-block" type="submit" value="'.Lang::trans('cpanellogin').'"/>
<input class="btn btn-primary btn-sm btn-block" type="submit" formaction="'.$webmailhref.'" value="'.Lang::trans('cpanelwebmaillogin').'"/>
</form>';  
   
	if (!is_null($primarySidebar->getChild('Service Details Actions'))) {
			$primarySidebar->getChild('Service Details Actions')
							->removeChild('Login to cPanel')
							->removeChild('Login to Webmail');
	}	
			$primarySidebar->addChild('cPanel Login', array(
							'label' => 'cPanel Logins',
							'icon' => 'fa-server',
							'order' => 20,
							'footerHtml' => $bodyhtml,
							));
	}
});

there are a handful of variables that you will have to update...

  • $clientid -> this is the client's ID value - you can get it from their client summary in the admin area.
    piyPA1J.png
  • username & password -> obviously change these to those given by your client.
  • cpanelhref & webmailhref -> replace domain.com with the url of your client.

if you don't want to show the webmail link, then just remove the last <input> line from the hook.

SnXzZjE.png

for the given user, assuming you get the username, password and URL correct, it should log them directly into cPanel without asking for login details.

Hello

I have improved your code to make it work for resellers and users.

basically if the customer's account is a reseller then the cpanel and whm buttons appear

but if a cpanel account, then cpanel only appears.

I have also added a condition to verify if the domain uses cloudflare, since if the domain uses cloudflare then it cannot be accessed through: https://domain.com:2083 or 2086,2087.

also for some reason the btn-block class does not work for me. therefore I made a new class to make it look like the original.

 

<?php
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) {
    $service = Menu::context('service');
    $servertype = $service->product->servertype;
    if ($servertype!="cpanel"){
        return;
    }
     $domain = $service->domain;
    $username = $service->username;
    $cloudflare = 'http://'.$domain.'';
    $get_cf = get_headers($cloudflare, 1)[Server];
    if ($get_cf != 'cloudflare'){
        $cpanelhref = 'https://'.$domain.':2083/login/';
        $webmailhref = 'https://'.$domain.':2096/login/';
        $webwhmhref = 'https://'.$domain.':2087/login/';
        $command = 'DecryptPassword';
        $postData = array('password2' => $service->password);
        $results = localAPI($command, $postData);
        $password = $results['password'];
        if ($service->product->type=="reselleraccount"){
            $whmcpanel = '<input class="btn btn-primary btn-sm block-btn mb-1" type="submit" formaction="'.$webwhmhref.'" value="'.Lang::trans('cpanelwhmlogin').'"/>';
         }
        $bodyhtml = '<form method="post" action="'.$cpanelhref.'" target="_blank">
        <input type="hidden" name="user" value ="'.$username.'"/>
        <input type="hidden" name="pass" value ="'.$password.'"/>
        <input class="btn btn-success btn-sm block-btn mb-1" type="submit" value="'.Lang::trans('cpanellogin').'"/>
        <input class="btn btn-danger btn-sm block-btn mb-1" type="submit" formaction="'.$webmailhref.'" value="'.Lang::trans('cpanelwebmaillogin').'"/>'.$whmcpanel.''.'
        </form>
        <a href="/contact.php" class="btn btn-info btn-sm block-btn mb-1" data-toggle="tooltip" data-placement="bottom" title="Si tiene problemas para ingresar a su panel, puede deberse a que usa una CDN o proxy como CloudFlare en su dominio, en este caso, contacte con soporte.">Ayuda <i class="fas fa-question-circle"></i></a>
        <style>.block-btn {width: 100%;}</style>';
        if (!is_null($primarySidebar->getChild('Service Details Actions'))) {
                $primarySidebar->getChild('Service Details Actions')
                                ->removeChild('Login to cPanel')
                                ->removeChild('Login to Webmail')
                                ->removeChild('Login to WHM');
        }
                $primarySidebar->addChild('cPanel Login', array(
                                'label' => 'Ingresar a cPanel/WHM',
                                'icon' => 'fa-server',
                                'order' => 20,
                                'footerHtml' => $bodyhtml,
                                ));
    }
});

Sorry for the texts in Spanish. you can edit if you want.

 

for resellers it looks like this:

2050178159_descarga-2020-07-28T020535_760.png.b8bc989ea7fba11cd60f869398271b36.png

and for customers it looks like this:

269284383_descarga-2020-07-28T020724_158.png.a9f1926772efa91df91cc4d492e3ffc7.png

and if the site has cloudflare then leave the default panel of whmcs.
 

Link to comment
Share on other sites

21 minutes ago, VirtualWorldGlobal said:

Hi @JesusSuarz

How does a reseller benefited by this script ? If you explain it would help...thanks

hi,

the reseller button is only available if the cpanel account is a reseller account.

in other words, if the cpanel account is not a reseller account then the WHM button for port 2086 or 2087 will then not be available.

that's the advantage.

In addition, the official whmcs plugin accesses the cpanel login through the server host link, not through the domain.

in other words, the official plugin allows users to access using (example): cpanel.yourhost.com

while this hook allows users to directly access the domain that has the hosting account.

example: yourhost.com/cpanel

 
Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated