Commit 072eee54 authored by soxofaan's avatar soxofaan

#881156 by elachlan and soxofaan: disable autocomplete on CAPTCHA response...

#881156 by elachlan and soxofaan: disable autocomplete on CAPTCHA response field with javascript (instead of with non-standard markup)
parent cc0c928d
// $Id$
// Javascript behaviors for general CAPTCHA functionality.
Drupal.behaviors.captcha = function (context) {
// Turn off autocompletion for the CAPTCHA response field.
// We do it here with Javascript (instead of directly in the markup)
// because this autocomplete attribute is not standard and
// it would break (X)HTML compliance.
$("#edit-captcha-response").attr("autocomplete", "off");
};
// JavaScript behaviors for the CAPTCHA admin page
Drupal.behaviors.captchaAdmin = function (context) {
......
......@@ -175,6 +175,9 @@ function captcha_process($element, $edit, &$form_state, $complete_form) {
module_load_include('inc', 'captcha');
// Add Javascript for general CAPTCHA functionality.
drupal_add_js(drupal_get_path('module', 'captcha') . '/captcha.js');
// Prevent caching of the page with CAPTCHA elements.
// This needs to be done even if the CAPTCHA will be ommitted later:
// other untrusted users should not get a cached page when
......@@ -674,7 +677,6 @@ function captcha_captcha($op, $captcha_type = '') {
'#size' => 4,
'#maxlength' => 2,
'#required' => TRUE,
'#attributes' => array('autocomplete' => 'off'),
);
return $result;
}
......
......@@ -232,7 +232,6 @@ function image_captcha_captcha($op, $captcha_type='', $captcha_sid=NULL) {
'#weight' => 0,
'#required' => TRUE,
'#size' => 15,
'#attributes' => array('autocomplete' => 'off'),
);
// Handle the case insensitive validation option combined with ignoring spaces.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment