mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 07:52:29 +03:00
Changed the CAPTCHA failure display (added input hint below the captcha input).
This commit is contained in:
parent
e69f7ca634
commit
0b43e4d918
4 changed files with 25 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -373,6 +373,7 @@
|
|||
</h4>
|
||||
<img class="captcha-image" src="<?php echo $this->config->item('base_url'); ?>/index.php/captcha">
|
||||
<input class="captcha-text" type="text" value="" />
|
||||
<span id="captcha-hint" class="help-block" style="opacity:0"> </span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue