diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php
index a8fd125e..14d09e20 100755
--- a/src/application/controllers/appointments.php
+++ b/src/application/controllers/appointments.php
@@ -339,7 +339,11 @@ class Appointments extends CI_Controller {
// Validate the CAPTCHA string.
if ($this->settings_model->get_setting('require_captcha') === '1'
&& $this->session->userdata('captcha_phrase') !== $_POST['captcha']) {
- throw new Exception($this->lang->line('captcha_is_wrong'));
+ echo json_encode(array(
+ 'captcha_verification' => FALSE,
+ 'expected_phrase' => $this->session->userdata('captcha_phrase')
+ ));
+ return;
}
// Check appointment availability.
diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php
index c85902ca..6862f80f 100644
--- a/src/application/views/appointments/book.php
+++ b/src/application/views/appointments/book.php
@@ -373,6 +373,7 @@
+
diff --git a/src/assets/css/frontend.css b/src/assets/css/frontend.css
index 87cbccb8..d612e26d 100644
--- a/src/assets/css/frontend.css
+++ b/src/assets/css/frontend.css
@@ -198,6 +198,8 @@ body {
#book-appointment-wizard .captcha-image {
float: right;
margin-bottom: 20px;
+ border-radius: 3px;
+ box-shadow: 1px 1px 4px rgba(0,0,0,0.4);
}
#book-appointment-wizard .captcha-text {
diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js
index b02abf20..26f772a5 100644
--- a/src/assets/js/frontend_book.js
+++ b/src/assets/js/frontend_book.js
@@ -620,7 +620,7 @@ var FrontendBook = {
if ($captchaText.length > 0) {
$captchaText.css('border', '');
if ($captchaText.val() === '') {
- $captchaText.css('border', '1px solid red');
+ $captchaText.css('border', '1px solid #dc3b40');
return;
}
}
@@ -668,6 +668,22 @@ var FrontendBook = {
return false;
}
+ if (response.captcha_verification === false) {
+ $('#captcha-hint')
+ .text(EALang['captcha_is_wrong'] + '(' + response.expected_phrase + ')')
+ .fadeTo(400, 1);
+
+ setTimeout(function() {
+ $('#captcha-hint').fadeTo(400, 0);
+ }, 3000);
+
+ $('.captcha-title small').trigger('click');
+
+ $captchaText.css('border', '1px solid #dc3b40');
+
+ return false;
+ }
+
window.location.replace(GlobalVariables.baseUrl
+ '/index.php/appointments/book_success/' + response.appointment_id);
})