From 9133aeedd6d362a0664ea131422dc618471201a3 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 9 Dec 2020 21:28:26 +0200 Subject: [PATCH] Applied Captcha fixes in the booking page --- application/views/appointments/book.php | 2 +- assets/js/frontend_book.js | 4 ++-- assets/js/frontend_book_api.js | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/application/views/appointments/book.php b/application/views/appointments/book.php index 6a4e77cb..47e511bc 100755 --- a/application/views/appointments/book.php +++ b/application/views/appointments/book.php @@ -366,7 +366,7 @@ - +   diff --git a/assets/js/frontend_book.js b/assets/js/frontend_book.js index f587270c..3c6a6f0c 100644 --- a/assets/js/frontend_book.js +++ b/assets/js/frontend_book.js @@ -424,7 +424,7 @@ window.FrontendBook = window.FrontendBook || {}; * * @param {jQuery.Event} event */ - $('#book-appointment-submit').on('click', function (event) { + $('#book-appointment-submit').on('click', function () { FrontendBookApi.registerAppointment(); }); @@ -433,7 +433,7 @@ window.FrontendBook = window.FrontendBook || {}; * * @param {jQuery.Event} event */ - $('.captcha-title small').on('click', function (event) { + $('.captcha-title svg').on('click', function (event) { $('.captcha-image').attr('src', GlobalVariables.baseUrl + '/index.php/captcha?' + Date.now()); }); diff --git a/assets/js/frontend_book_api.js b/assets/js/frontend_book_api.js index 5fd9cecb..119eeaed 100755 --- a/assets/js/frontend_book_api.js +++ b/assets/js/frontend_book_api.js @@ -146,7 +146,8 @@ window.FrontendBookApi = window.FrontendBookApi || {}; } } - var formData = jQuery.parseJSON($('input[name="post_data"]').val()); + var formData = JSON.parse($('input[name="post_data"]').val()); + var data = { csrfToken: GlobalVariables.csrfToken, post_data: formData @@ -193,7 +194,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; $('#captcha-hint').fadeTo(400, 0); }, 3000); - $('.captcha-title small').trigger('click'); + $('.captcha-title svg').trigger('click'); $captchaText.closest('.form-group').addClass('has-error'); @@ -204,7 +205,7 @@ window.FrontendBookApi = window.FrontendBookApi || {}; + '/index.php/appointments/book_success/' + response.appointment_hash; }) .fail(function (jqxhr, textStatus, errorThrown) { - $('.captcha-title small').trigger('click'); + $('.captcha-title svg').trigger('click'); }) .always(function () { $layer.remove();