Skip to content

Commit

Permalink
fixed recaptcha varfication issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zubairraeen committed Dec 27, 2023
1 parent 208d991 commit 4ca539d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ function qmnValidation(element, quiz_form_id) {
by_pass = false;
}

if (localStorage.getItem('mlw_time_quiz' + quiz_id) === null || localStorage.getItem('mlw_time_quiz' + quiz_id) > 0.08 || by_pass === false) {
if (localStorage.getItem('mlw_time_quiz' + quiz_id) === null || 0 === localStorage.getItem('mlw_time_quiz' + quiz_id) || localStorage.getItem('mlw_time_quiz' + quiz_id) > 0.08 || by_pass === false) {

if (jQuery(this).attr('class').indexOf('mlwRequiredNumber') > -1 && this.value === "" && +this.value != NaN) {
qmnDisplayError(error_messages.number_error_text, jQuery(this), quiz_form_id);
Expand Down Expand Up @@ -806,8 +806,10 @@ function qmnValidation(element, quiz_form_id) {
}
//Google recaptcha validation
if (jQuery(this).attr('class').indexOf('g-recaptcha-response') > -1) {
if (grecaptcha.getResponse() == "") {
alert('ReCaptcha is missing');
let recaptcha_id = jQuery(this).attr('id');
let recaptcha_index = recaptcha_id.replace("g-recaptcha-response-", "");
if (grecaptcha.getResponse(recaptcha_index) == "") {
alert(error_messages.recaptcha_error_text);
show_result_validation = false;
}
}
Expand Down
1 change: 1 addition & 0 deletions php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ public function display_quiz( $options, $quiz_data, $question_amount, $shortcode
'url_error_text' => $mlwQuizMasterNext->pluginHelper->qsm_language_support( $options->url_error_text, "quiz_url_error_text-{$options->quiz_id}" ),
'minlength_error_text' => $mlwQuizMasterNext->pluginHelper->qsm_language_support( $options->minlength_error_text, "quiz_minlength_error_text-{$options->quiz_id}" ),
'maxlength_error_text' => $mlwQuizMasterNext->pluginHelper->qsm_language_support( $options->maxlength_error_text, "quiz_maxlength_error_text-{$options->quiz_id}" ),
'recaptcha_error_text' => __( 'ReCaptcha is missing', 'quiz-master-next' ),
);
$qmn_json_data = apply_filters( 'qsm_json_error_message', $qmn_json_data ,$options);
wp_enqueue_script( 'progress-bar', QSM_PLUGIN_JS_URL . '/progressbar.min.js', array(), '1.1.0', true );
Expand Down

0 comments on commit 4ca539d

Please sign in to comment.