fix: Update registration pending page email to joe@upskillhvac.com with bot protection

- Updated default email in HVAC_Activator from support@upskillevents.com to joe@upskillhvac.com
- Added email obfuscation methods (obfuscate_email, encode_email) to HVAC_Page_Manager
- Updated registration pending template to use {support_email_encoded} placeholder
- Added JavaScript and HTML entity protection against email harvesting bots

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Ben Reed <ben@tealmaker.com>
This commit is contained in:
bengizmo 2025-08-06 07:55:02 -03:00
parent 50a9102119
commit 38688ef43d
4 changed files with 120 additions and 3 deletions

View file

@ -261,7 +261,7 @@ class HVAC_Activator {
*/ */
private static function set_default_options() { private static function set_default_options() {
// General settings // General settings
add_option('hvac_support_email', 'support@upskillevents.com'); add_option('hvac_support_email', 'joe@upskillhvac.com');
add_option('hvac_trainer_approval_required', true); add_option('hvac_trainer_approval_required', true);
add_option('hvac_inactive_days_threshold', 180); add_option('hvac_inactive_days_threshold', 180);

View file

@ -454,7 +454,9 @@ class HVAC_Page_Manager {
'{logout_url}' => wp_logout_url(home_url()), '{logout_url}' => wp_logout_url(home_url()),
'{login_url}' => home_url('/training-login/'), '{login_url}' => home_url('/training-login/'),
'{site_name}' => get_bloginfo('name'), '{site_name}' => get_bloginfo('name'),
'{support_email}' => get_option('hvac_support_email', 'support@upskillevents.com') '{support_email}' => get_option('hvac_support_email', 'joe@upskillhvac.com'),
'{support_email_obfuscated}' => self::obfuscate_email(get_option('hvac_support_email', 'joe@upskillhvac.com')),
'{support_email_encoded}' => self::encode_email(get_option('hvac_support_email', 'joe@upskillhvac.com'))
]; ];
$content = str_replace(array_keys($replacements), array_values($replacements), $content); $content = str_replace(array_keys($replacements), array_values($replacements), $content);
@ -573,4 +575,56 @@ class HVAC_Page_Manager {
HVAC_Logger::info('Completed page layout and template updates', 'Page Manager'); HVAC_Logger::info('Completed page layout and template updates', 'Page Manager');
} }
/**
* Obfuscate email address to prevent bot harvesting
*
* @param string $email Email address to obfuscate
* @return string Obfuscated email HTML
*/
public static function obfuscate_email($email) {
$obfuscated = '';
$len = strlen($email);
// Convert each character to HTML entity
for ($i = 0; $i < $len; $i++) {
$char = $email[$i];
// Mix between decimal and hex entities
if (mt_rand(0, 1)) {
$obfuscated .= '&#' . ord($char) . ';';
} else {
$obfuscated .= '&#x' . dechex(ord($char)) . ';';
}
}
return $obfuscated;
}
/**
* Encode email with JavaScript protection
*
* @param string $email Email address to encode
* @return string JavaScript-protected email HTML
*/
public static function encode_email($email) {
$encoded = '';
$len = strlen($email);
// Create reversed and encoded email
$reversed = strrev($email);
for ($i = 0; $i < $len; $i++) {
$encoded .= '&#' . ord($reversed[$i]) . ';';
}
// Return JavaScript that decodes and reverses the email
return '<script type="text/javascript">
document.write(\'<a href="mailto:\' + \'' . $encoded . '\'.replace(/&#(\\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
}).split("").reverse().join("") + \'">\' + \'' . self::obfuscate_email($email) . '\' + \'</a>\');
</script>
<noscript>
<span style="unicode-bidi: bidi-override; direction: rtl;">' . self::obfuscate_email(strrev($email)) . '</span>
<br><small>(Enable JavaScript to view email)</small>
</noscript>';
}
} }

View file

@ -0,0 +1,63 @@
<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|60","left":"var:preset|spacing|40","right":"var:preset|spacing|40"}}},"layout":{"type":"constrained","contentSize":"800px"}} -->
<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--60);padding-right:var(--wp--preset--spacing--40);padding-bottom:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--40)"><!-- wp:group {"style":{"color":{"background":"#ffffff"},"border":{"radius":"8px"},"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50","right":"var:preset|spacing|50"}},"shadow":"0 2px 10px rgba(0,0,0,0.1)"}} -->
<div class="wp-block-group has-background" style="border-radius:8px;background-color:#ffffff;padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--50);box-shadow:0 2px 10px rgba(0,0,0,0.1)"><!-- wp:group {"style":{"spacing":{"blockGap":"0"}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"center"}} -->
<div class="wp-block-group"><!-- wp:paragraph {"style":{"typography":{"fontSize":"60px"},"color":{"text":"#28a745"}}} -->
<p class="has-text-color" style="color:#28a745;font-size:60px"></p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
<!-- wp:heading {"textAlign":"center","level":1,"style":{"spacing":{"margin":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40"}}}} -->
<h1 class="wp-block-heading has-text-align-center" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40)">Account is Pending Approval</h1>
<!-- /wp:heading -->
<!-- wp:heading {"textAlign":"center","level":2,"style":{"spacing":{"margin":{"bottom":"var:preset|spacing|30"}}}} -->
<h2 class="wp-block-heading has-text-align-center" style="margin-bottom:var(--wp--preset--spacing--30)">Registration Submitted Successfully</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center","style":{"spacing":{"margin":{"bottom":"var:preset|spacing|30"}}}} -->
<p class="has-text-align-center" style="margin-bottom:var(--wp--preset--spacing--30)">Thank you for registering as an HVAC trainer! Your registration has been submitted and is currently being reviewed by our team.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"center","style":{"spacing":{"margin":{"bottom":"var:preset|spacing|40"}}}} -->
<p class="has-text-align-center" style="margin-bottom:var(--wp--preset--spacing--40)">You will receive an email notification once your account has been approved and activated. This process typically takes 1-2 business days.</p>
<!-- /wp:paragraph -->
<!-- wp:group {"style":{"color":{"background":"#d4edda"},"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|30","right":"var:preset|spacing|30"},"margin":{"top":"var:preset|spacing|40","bottom":"var:preset|spacing|40"}},"border":{"radius":"4px"}}} -->
<div class="wp-block-group has-background" style="border-radius:4px;background-color:#d4edda;margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--40);padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)"><!-- wp:heading {"level":3,"style":{"spacing":{"margin":{"top":"0"}}}} -->
<h3 class="wp-block-heading" style="margin-top:0">What's Next?</h3>
<!-- /wp:heading -->
<!-- wp:list -->
<ul><!-- wp:list-item -->
<li>Check your email for confirmation of your registration</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>Our team will review your application and credentials</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>You'll receive approval notification via email</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>Once approved, you can log in and start creating events</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list --></div>
<!-- /wp:group -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">If you have any questions about your registration, please contact our support team at {support_email_encoded}.</p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"},"style":{"spacing":{"margin":{"top":"var:preset|spacing|50"}}}} -->
<div class="wp-block-buttons" style="margin-top:var(--wp--preset--spacing--50)"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="{login_url}">Return to Login</a></div>
<!-- /wp:button -->
<!-- wp:button {"className":"is-style-outline"} -->
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button" href="{home_url}">Go to Homepage</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->

View file

@ -11,7 +11,7 @@ get_header();
<h1>Registration Pending</h1> <h1>Registration Pending</h1>
<p>Thank you for registering! Your registration is currently pending approval.</p> <p>Thank you for registering! Your registration is currently pending approval.</p>
<p>You will receive an email notification once your account has been approved.</p> <p>You will receive an email notification once your account has been approved.</p>
<p>If you have any questions, please contact support at <?php echo esc_html(get_option('hvac_support_email', 'support@upskillevents.com')); ?>.</p> <p>If you have any questions, please contact support at <?php echo HVAC_Page_Manager::encode_email(get_option('hvac_support_email', 'joe@upskillhvac.com')); ?>.</p>
<p><a href="<?php echo esc_url(home_url('/')); ?>" class="ast-button">Return to Home</a></p> <p><a href="<?php echo esc_url(home_url('/')); ?>" class="ast-button">Return to Home</a></p>
</div> </div>
</div> </div>