Skip to content

WHMCS‐Pterodactyl Sync Setup

Aleksandar Ovcharov edited this page Sep 5, 2024 · 5 revisions

PteroSync & WHMCS Integration Guide

This guide provides detailed instructions on configuring PteroSync to work seamlessly with WHMCS. Follow the steps below to ensure a smooth integration and maintain consistency across your platforms.

Warning

Passwords will not be auto sync for old clients!

How does it work?

  • For new clients it create pterodactyl user and it set the password.
  • For old/existing clients they must change theirs password at least one time via WHMCS!
  • Ensure you follow the steps below.

1. Configure config.json for PteroSync

To ensure proper synchronization between WHMCS and Pterodactyl, adjust the following settings in your config.json file:

enable_whmcs_user_sync

  • Purpose: Automatically synchronizes users between WHMCS and Pterodactyl.
  • Recommended Setting: true
  • Benefit: Ensures user information is consistently updated on both platforms.

enable_client_area_password_changer

  • Purpose: Manages where users can change their passwords.
  • Recommended Setting: false
  • Benefit: Directs users to change their password through WHMCS, enhancing security and consistency.

2. Modify Pterodactyl's Controllers

To prevent users from bypassing WHMCS for account updates, you'll need to modify specific methods in various Pterodactyl controllers.

Files and Methods to be Modified

  1. app/Http/Controllers/Auth/ForgotPasswordController.php

    • Method: sendResetLinkEmail
  2. app/Http/Controllers/Auth/ResetPasswordController.php

    • Method: resetPassword
  3. app/Http/Controllers/Api/Client/AccountController.php

    • Methods: updateEmail and updatePassword

Instructions for Modifying the Methods

  1. Locate the Methods:

    • Navigate to each of the following files:
      • app/Http/Controllers/Auth/ForgotPasswordController.php
      • app/Http/Controllers/Auth/ResetPasswordController.php
      • app/Http/Controllers/Api/Client/AccountController.php
    • Find the relevant methods in each file.
  2. Add the Following Code:

    • At the top of each method, insert the following return statement:
    return response()->json([
        'message' => 'This operation is managed through WHMCS. Please update your information there.',
    ], 403);

Example of Updated Method in AccountController.php

public function updateEmail(Request $request)
{
    return response()->json([
        'message' => 'This operation is managed through WHMCS. Please update your information there.',
    ], 403);

    // Original method code...
}

Visual Example

Example

This modification ensures that any attempt to update user information directly through Pterodactyl will be redirected to WHMCS, maintaining consistent data management.