Skip to content
Snippets Groups Projects
Commit 4b62e47a authored by Jared Hancock's avatar Jared Hancock
Browse files

Use seemingly-random form input names

Which will help fight off spammers. This should be coupled with logic that
will add some enticing fields, like 'email' and 'name' to invite bot input.
Then, on the form processing side, a spam submission can be detected and
handled differently from human submissions. This should lessen reliance on
CAPTCHA only as spam detection.
parent 5aad4829
No related branches found
No related tags found
No related merge requests found
...@@ -801,14 +801,15 @@ class SelectionWidget extends ChoicesWidget { ...@@ -801,14 +801,15 @@ class SelectionWidget extends ChoicesWidget {
?> ?>
<span style="display:inline-block"> <span style="display:inline-block">
<input type="text" size="30" name="<?php echo $this->name; ?>" <input type="text" size="30" name="<?php echo $this->name; ?>"
value="<?php echo $name; ?>" autocomplete="off" /> id="<?php echo $this->name; ?>" value="<?php echo $name; ?>"
autocomplete="off" />
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('input[name=<?php echo $this->name; ?>]').typeahead({ $('input#<?php echo $this->name; ?>').typeahead({
source: <?php echo JsonDataEncoder::encode($source); ?>, source: <?php echo JsonDataEncoder::encode($source); ?>,
property: 'info', property: 'info',
onselect: function(item) { onselect: function(item) {
$('input[name="<?php echo $this->name; ?>"]').val(item['value']) $('input#<?php echo $this->name; ?>').val(item['value'])
} }
}); });
}); });
......
...@@ -302,7 +302,8 @@ class FormField { ...@@ -302,7 +302,8 @@ class FormField {
function getFormName() { function getFormName() {
if (is_numeric($this->get('id'))) if (is_numeric($this->get('id')))
return '-field-id-'.$this->get('id'); return substr(md5(
session_id() . '-field-id-'.$this->get('id')), -16);
else else
return $this->get('id'); return $this->get('id');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment