Giter VIP home page Giter VIP logo

whmcs-turnstile's Introduction

WHMCS Turnstile Captcha

Enables Cloudflare's Turnstile Captcha service in abandonware WHMCS. This is currently a proof-of-concept, please report issues.

Introduction

By default WHMCS offers two types of captchas, the built-in-easily-cracked GD based captcha and the easily-cracked-privacy-violating reCAPTCHA by Google. Because WHMCS fails to maintain their product, we developed this simple to use hook which enables Turnstile while completely bypassing WHMCS' logic.

Please note that this implementation required some filthy JS query code to make it work, because WHMCS is a complete mess: in some pages they used HTML buttons for forms, on other pages they used input submits, with or without IDs, inside divs, without divs, no use of IDs. Meaning that there was no streamlined way to do this clean and proper. Here are some awkward examples:

<input class="btn btn-lg btn-primary" type="submit" value="Register">
<button id="login" type="submit" class="btn btn-primary">Login</button>
<button type="submit" name="validatepromo" class="btn btn-block btn-default" value="Validate Code">Validate Code</button>
<button type="submit" class="btn btn-primary">Send Message</button>
<a href="/cart.php?a=checkout&amp;e=false" class="btn btn-success btn-lg btn-checkout disabled" id="checkout">Checkout</a>

Features

  • Enables Turnstile captcha on login, register, checkout, ticket, contact pages.
  • Support for themes (auto/dark/light).
  • Ability to disable credits and have it fully white labeled.

Requirements

  • PHP 8.x (tested on 8.1.23)
  • WHMCS 8.x (tested on 8.7.3)

Installation

  1. Download the latest release and unzip it in the root of your WHMCS installation.
  2. Get your Turnstile Site Key and Secret Key from your Cloudflare dashboard.
  3. Edit and add the following settings in either your configuration.php or at the top of the hook file:
const hybulaTurnstileEnabled = true;
const hybulaTurnstileCredits = true;
const hybulaTurnstileSite = '';
const hybulaTurnstileSecret = '';
const hybulaTurnstileTheme = 'auto';
const hybulaTurnstileError = 'Something went wrong with your captcha challenge!';
const hybulaTurnstileLocations = ['login', 'register', 'checkout', 'ticket', 'contact'];

Contribute

Contributions are welcome in a form of a pull request (PR).

Sponsored

This project is developed and sponsored by Hybula B.V.

License

Apache License, Version 2.0 and the Commons Clause Restriction

whmcs-turnstile's People

Contributors

dqos avatar jouandeag avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.