Add CSRF, CAPTCHA, and input validation improvements
Introduces CSRF protection to all sensitive controller actions, integrates configurable CAPTCHA (reCAPTCHA v2/v3, Turnstile) for authentication and registration flows, and centralizes input validation via a new InputValidator helper. Adds new helpers and services for CSRF and CAPTCHA, updates settings and migration for CAPTCHA configuration, and enhances logging and error handling in TLD registry import processes. Also improves validation for user, domain, group, and profile inputs throughout the application.
This commit is contained in:
32
app/Helpers/CsrfHelper.php
Normal file
32
app/Helpers/CsrfHelper.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* CSRF Helper Functions
|
||||
*
|
||||
* Global helper functions for CSRF protection in views
|
||||
*/
|
||||
|
||||
if (!function_exists('csrf_field')) {
|
||||
/**
|
||||
* Generate HTML for CSRF token hidden field
|
||||
*
|
||||
* @return string HTML input field
|
||||
*/
|
||||
function csrf_field(): string
|
||||
{
|
||||
return \Core\Csrf::field();
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('csrf_token')) {
|
||||
/**
|
||||
* Get the current CSRF token value
|
||||
*
|
||||
* @return string The CSRF token
|
||||
*/
|
||||
function csrf_token(): string
|
||||
{
|
||||
return \Core\Csrf::getToken();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user