Skip to content

Commit

Permalink
Merge pull request #82 from mirabellette/patch-2
Browse files Browse the repository at this point in the history
Possibility to make the captcha's input required
  • Loading branch information
dapphp authored May 30, 2020
2 parents 58f05bc + 6a6d1cf commit 3bd1017
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions securimage.php
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,7 @@ public static function getCaptchaHtml($options = array(), $parts = Securimage::H
$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;
Expand Down Expand Up @@ -1540,6 +1541,7 @@ public static function getCaptchaHtml($options = array(), $parts = Securimage::H
$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));
Expand Down

0 comments on commit 3bd1017

Please sign in to comment.