Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve captcha issue at localhost #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion assets/frontend/js/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ jQuery( document ).ready( function ( $ ) {
}
);

var hideCap = document.getElementById('hideCap').value;
console.log(hideCap);


$( '#woocommerce-submit-enquiry' ).on( 'click', function () {
var name = document.getElementById( 'woocommerce-user-name' ).value;
var email = document.getElementById( 'woocommerce-user-email' ).value;
Expand Down Expand Up @@ -191,7 +195,7 @@ jQuery( document ).ready( function ( $ ) {
.focus();
return false;
}
if ( captcha && captcha.value != catalog_enquiry_front.captcha ) {
if ( captcha && captcha.value != hideCap ) {
document.getElementById( 'msg-for-enquiry-error' ).innerHTML =
catalog_enquiry_front.error_levels.captcha_valid;
document
Expand Down
6 changes: 5 additions & 1 deletion classes/class-woocommerce-catalog-enquiry-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,11 @@ public function add_form_for_enquiry_without_popup() {
} else {
echo __('Security Code', 'woocommerce-catalog-enquiry');
}
?> <span class="noselect captcha-wrap"><i><?php echo get_transient('woocaptcha'); ?></i></span></p>
?>
<div>
<input type="hidden" id="hideCap" value="<?php echo get_transient('woocaptcha'); ?>">
</div>
<span class="noselect captcha-wrap"><i><?php echo get_transient('woocaptcha'); ?></i></span></p>
<p><?php
echo __('Enter the security code shown above', 'woocommerce-catalog-enquiry');
?> </p>
Expand Down