← All changes
|
includes/admin/tickets/class-wpsc-current-user-profile.php
+16
-1
3.4.7
→
3.5.4
View file →
| @@ -99,9 +99,9 @@ | ||
| 99 | 99 | jQuery(el).text(supportcandy.translations.please_wait); |
| 100 | 100 | |
| 101 | 101 | <?php |
| 102 | 102 | $recaptcha = get_option( 'wpsc-recaptcha-settings' ); |
| 103 | - if ( $recaptcha['allow-recaptcha'] === 1 && $recaptcha['recaptcha-version'] == 3 && $recaptcha['recaptcha-site-key'] && $recaptcha['recaptcha-secret-key'] ) { | |
| 103 | + if ( $recaptcha['captcha-provider'] === 'google-recaptcha' && $recaptcha['recaptcha-version'] == 3 && $recaptcha['recaptcha-site-key'] && $recaptcha['recaptcha-secret-key'] ) { | |
| 104 | 104 | ?> |
| 105 | 105 | grecaptcha.ready(function() { |
| 106 | 106 | grecaptcha.execute('<?php echo esc_attr( $recaptcha['recaptcha-site-key'] ); ?>', {action: 'submit_my_profile'}).then(function(token) { |
| 107 | 107 | dataform.append('g-recaptcha-response', token); |
| @@ -108,8 +108,23 @@ | ||
| 108 | 108 | wpsc_post_my_profile_form(dataform); |
| 109 | 109 | }); |
| 110 | 110 | }); |
| 111 | 111 | <?php |
| 112 | + } elseif ( $recaptcha['captcha-provider'] === 'cloudflare-turnstile' && $recaptcha['cloudflare-site-key'] && $recaptcha['cloudflare-secret-key'] ) { | |
| 113 | + ?> | |
| 114 | + var token = dataform.get('cf-turnstile-response'); | |
| 115 | + if (!token) { | |
| 116 | + alert("<?php esc_attr_e( 'Security verification failed. Please refresh the page and try again.', 'supportcandy' ); ?>"); | |
| 117 | + return; | |
| 118 | + } | |
| 119 | + | |
| 120 | + dataform.set( | |
| 121 | + 'cf-turnstile-response', | |
| 122 | + token | |
| 123 | + ); | |
| 124 | + wpsc_post_my_profile_form(dataform); | |
| 125 | + <?php | |
| 126 | + | |
| 112 | 127 | } else { |
| 113 | 128 | ?> |
| 114 | 129 | wpsc_post_my_profile_form(dataform); |
| 115 | 130 | <?php |