Commit e0ad0c03 authored by soxofaan's avatar soxofaan

Drupal6 port of Image CAPTCHA: fixed validation of settings form

parent 1497cf5e
......@@ -208,6 +208,7 @@ function image_captcha_settings_form() {
),
'#default_value' => (int) variable_get('image_captcha_noise_level', 5),
);
$form['#validate'] = array('image_captcha_settings_form_validate');
return system_settings_form($form);
}
......@@ -227,14 +228,14 @@ function image_captcha_settings_form_pre_render($form) {
/**
* Validation function for image_captcha configuration form
*/
function image_captcha_settings_form_validate($form_id, $form_values) {
if ($form_id == 'image_captcha_settings_form') {
function image_captcha_settings_form_validate($form, &$form_state) {
if ($form['form_id']['#value'] == 'image_captcha_settings_form') {
// check image_captcha_image_allowed_chars for spaces
if (preg_match('/\s/', $form_values['image_captcha_image_allowed_chars'])) {
if (preg_match('/\s/', $form_state['values']['image_captcha_image_allowed_chars'])) {
form_set_error('image_captcha_image_allowed_chars', t('The list of characters to use should not contain spaces.'));
}
// check font
$font = $form_values['image_captcha_font'];
$font = $form_state['values']['image_captcha_font'];
if ($font == '0') {
form_set_error('image_captcha_font', t('You need to select a font'));
}
......
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