CyberPanel Community

Auto login to client account

OO
Oluwatobi Owolabi #1

The ability to auto login to a client account for helping or viewing technical issues.

4 replies
sh
shoaibkk #2

Do you mean the cyberpanel access?

OO
Oluwatobi Owolabi #3

Yes, to be able to login to a client account without password just as we have for wordpress autologin

lu
luckyrajpurohit #4

If you have admin access then you have all the right. Do you want non-admin to allow other user websites?

JS
Jesus Suarez #5

After some additional research, I found a solution for the auto-login feature. I wasn’t aware there was an API endpoint available for this, so I created the following script PHP that enables auto-login. You only need to change the IP, username, and password:

<?php
// cyberpanel_autologin_form.php
// Auto-submit form to CyberPanel /api/loginAPI so the browser receives the session cookie.
// WARNING: this file contains plaintext credentials. Make sure to protect access to it 
// (e.g., restrict by IP, use htpasswd, or move it outside the web root).

$panel_base = 'https://YOUR_IP_CYBERPANEL:8090';
$panel_user = 'admin';
$panel_pass = 'PASSWORD_CYBERPANEL_ADMIN';
$language   = 'english'; // change if needed

// Target behavior: '_blank' opens a new tab (recommended), '_self' replaces the current page.
// It’s best to leave it as '_blank' to avoid replacing the existing site.
$target = '_blank';
?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>CyberPanel AutoLogin</title>
</head>
<body>
  <form id="cyberpanel_autologin" action="<?php echo htmlspecialchars($panel_base); ?>/api/loginAPI" method="post" target="<?php echo htmlspecialchars($target); ?>">
    <input type="hidden" name="username" value="<?php echo htmlspecialchars($panel_user); ?>">
    <input type="hidden" name="password" value="<?php echo htmlspecialchars($panel_pass); ?>">
    <input type="hidden" name="languageSelection" value="<?php echo htmlspecialchars($language); ?>">
    <noscript>
      <p>JavaScript is required for automatic login. Press the button below to continue.</p>
      <button type="submit">Login to CyberPanel</button>
    </noscript>
  </form>

  <script>
    // Auto-submit on page load
    (function(){
      try {
        var f = document.getElementById('cyberpanel_autologin');
        if (f) f.submit();
      } catch (e) {
        // fallback: display the submit button if JavaScript fails
        console.error('Auto-submit failed', e);
      }
    })();
  </script>
</body>
</html>

Sign in to reply