diff --git a/code/SecurityAdmin.php b/code/SecurityAdmin.php index 28ed5a50..55619339 100644 --- a/code/SecurityAdmin.php +++ b/code/SecurityAdmin.php @@ -81,8 +81,11 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { $fieldName = $this->urlParams['ID']; $fieldVal = $_REQUEST[$fieldName]; $result = ''; + + // Make sure we only autocomplete on keys that actually exist, and that we don't autocomplete on password + if(!array_key_exists($fieldName, singleton($this->stat('subitem_class'))->stat('db')) && $fieldName != 'Password') return; - $matches = DataObject::get($this->stat('subitem_class'),"$fieldName LIKE '" . addslashes($fieldVal) . "%'"); + $matches = DataObject::get($this->stat('subitem_class'),"$fieldName LIKE '" . Convert::raw2sql($fieldVal) . "%'"); if($matches) { $result .= ""; @@ -227,4 +229,4 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { } } -?> \ No newline at end of file +?>