Applied Captcha fixes in the booking page

This commit is contained in:
Alex Tselegidis 2020-12-09 21:28:26 +02:00
parent 67c85c83e0
commit 9133aeedd6
3 changed files with 7 additions and 6 deletions

View file

@ -366,7 +366,7 @@
<small class="fas fa-sync-alt"></small> <small class="fas fa-sync-alt"></small>
</h4> </h4>
<img class="captcha-image" src="<?= site_url('captcha') ?>"> <img class="captcha-image" src="<?= site_url('captcha') ?>">
<input class="captcha-text" type="text" value=""/> <input class="captcha-text form-control" type="text" value=""/>
<span id="captcha-hint" class="help-block" style="opacity:0">&nbsp;</span> <span id="captcha-hint" class="help-block" style="opacity:0">&nbsp;</span>
</div> </div>
</div> </div>

View file

@ -424,7 +424,7 @@ window.FrontendBook = window.FrontendBook || {};
* *
* @param {jQuery.Event} event * @param {jQuery.Event} event
*/ */
$('#book-appointment-submit').on('click', function (event) { $('#book-appointment-submit').on('click', function () {
FrontendBookApi.registerAppointment(); FrontendBookApi.registerAppointment();
}); });
@ -433,7 +433,7 @@ window.FrontendBook = window.FrontendBook || {};
* *
* @param {jQuery.Event} event * @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()); $('.captcha-image').attr('src', GlobalVariables.baseUrl + '/index.php/captcha?' + Date.now());
}); });

View file

@ -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 = { var data = {
csrfToken: GlobalVariables.csrfToken, csrfToken: GlobalVariables.csrfToken,
post_data: formData post_data: formData
@ -193,7 +194,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
$('#captcha-hint').fadeTo(400, 0); $('#captcha-hint').fadeTo(400, 0);
}, 3000); }, 3000);
$('.captcha-title small').trigger('click'); $('.captcha-title svg').trigger('click');
$captchaText.closest('.form-group').addClass('has-error'); $captchaText.closest('.form-group').addClass('has-error');
@ -204,7 +205,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
+ '/index.php/appointments/book_success/' + response.appointment_hash; + '/index.php/appointments/book_success/' + response.appointment_hash;
}) })
.fail(function (jqxhr, textStatus, errorThrown) { .fail(function (jqxhr, textStatus, errorThrown) {
$('.captcha-title small').trigger('click'); $('.captcha-title svg').trigger('click');
}) })
.always(function () { .always(function () {
$layer.remove(); $layer.remove();