mirror of
https://github.com/hybula/whmcs-turnstile.git
synced 2026-01-06 15:41:58 +00:00
Add login exclusion
This commit is contained in:
@@ -20,10 +20,11 @@ Please note that this implementation required some filthy JS query code to make
|
||||
- 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.
|
||||
- Ability to exclude captcha when client is logged in.
|
||||
|
||||
### Requirements
|
||||
- PHP 8.x (tested on 8.1.23)
|
||||
- WHMCS 8.x (tested on 8.7.3)
|
||||
- PHP 8.x (tested on 8.1.27)
|
||||
- WHMCS 8.x (tested on 8.9.0)
|
||||
|
||||
### Installation
|
||||
1. Download the latest release and unzip it in the root of your WHMCS installation.
|
||||
@@ -32,6 +33,7 @@ Please note that this implementation required some filthy JS query code to make
|
||||
```php
|
||||
const hybulaTurnstileEnabled = true;
|
||||
const hybulaTurnstileCredits = true;
|
||||
const hybulaTurnstileExcludeLogin = true;
|
||||
const hybulaTurnstileSite = '';
|
||||
const hybulaTurnstileSecret = '';
|
||||
const hybulaTurnstileTheme = 'auto';
|
||||
|
||||
@@ -20,7 +20,7 @@ if (!defined('WHMCS')) {
|
||||
die('This file cannot be accessed directly!');
|
||||
}
|
||||
|
||||
if (!empty($_POST)) {
|
||||
if (!empty($_POST) && (!isset($_SESSION['uid']) && hybulaTurnstileExcludeLogin)) {
|
||||
$pageFile = basename($_SERVER['SCRIPT_NAME'], '.php');
|
||||
if ((($pageFile == 'index' && isset($_POST['username']) && isset($_POST['password']) && in_array('login', hybulaTurnstileLocations)) ||
|
||||
($pageFile == 'register' && in_array('register', hybulaTurnstileLocations)) ||
|
||||
@@ -62,7 +62,7 @@ if (!empty($_POST)) {
|
||||
}
|
||||
|
||||
add_hook('ClientAreaFooterOutput', 1, function ($vars) {
|
||||
if (!hybulaTurnstileEnabled) {
|
||||
if (!hybulaTurnstileEnabled || (isset($_SESSION['uid']) && hybulaTurnstileExcludeLogin)) {
|
||||
return '';
|
||||
}
|
||||
$pageFile = basename($_SERVER['SCRIPT_NAME'], '.php');
|
||||
|
||||
Reference in New Issue
Block a user