Unverified Commit 6a6d1cfe authored by mirabellette's avatar mirabellette Committed by GitHub
Browse files

Possibility to make the captcha's input required

I added to the captcha's input text a required tag in order to oblige the user to fill it.

It could be disable with  'input_required' => false. 

For example:
Securimage::getCaptchaHtml(array('input_required' => false))
No related merge requests found
Showing with 2 additions and 0 deletions
+2 -0
......@@ -1368,6 +1368,7 @@ class Securimage
$input_text = (isset($options['input_text'])) ? $options['input_text'] : 'Type the text:';
$input_id = (isset($options['input_id'])) ? $options['input_id'] : 'captcha_code';
$input_name = (isset($options['input_name'])) ? $options['input_name'] : $input_id;
$input_required = (isset($options['input_required'])) ? (bool)$options['input_required'] : true;
$input_attrs = (isset($options['input_attributes'])) ? $options['input_attributes'] : array();
$image_attrs = (isset($options['image_attributes'])) ? $options['image_attributes'] : array();
$error_html = (isset($options['error_html'])) ? $options['error_html'] : null;
......@@ -1533,6 +1534,7 @@ class Securimage
$input_attrs['name'] = $input_name;
$input_attrs['id'] = $input_id;
$input_attrs['autocomplete'] = 'off';
if ($input_required) $input_attrs['required'] = $input_required;
foreach($input_attrs as $name => $val) {
$input_attr .= sprintf('%s="%s" ', $name, htmlspecialchars($val));
......
Supports Markdown
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