limit key length to 12
This commit is contained in:
parent
f0086e725b
commit
a206e9fefe
|
@ -1354,9 +1354,10 @@ abstract class baseModule {
|
|||
* @param array $autoCompleteValues values for auto-completion
|
||||
* @param integer $fieldSize field size
|
||||
* @param array $htmlIDs reference to array where to add the generated HTML IDs of the input fields
|
||||
* @param string $cssClasses additional CSS classes of input fields
|
||||
*/
|
||||
protected function addMultiValueInputTextField(&$container, $attrName, $label, $required = false, $length = null, $isTextArea = false,
|
||||
$autoCompleteValues = null, $fieldSize = null, &$htmlIDs = null) {
|
||||
$autoCompleteValues = null, $fieldSize = null, &$htmlIDs = null, $cssClasses = '') {
|
||||
$values = array();
|
||||
if (isset($this->attributes[$attrName][0])) {
|
||||
$values = $this->attributes[$attrName];
|
||||
|
@ -1376,6 +1377,9 @@ abstract class baseModule {
|
|||
for ($i = 0; $i < sizeof($values); $i++) {
|
||||
if (!$isTextArea) {
|
||||
$input = new htmlInputField($attrName . '_' . $i, $values[$i]);
|
||||
if (!empty($cssClasses)) {
|
||||
$input->setCSSClasses(array($cssClasses));
|
||||
}
|
||||
if (!empty($length)) {
|
||||
$input->setFieldMaxLength($length);
|
||||
}
|
||||
|
@ -1392,7 +1396,11 @@ abstract class baseModule {
|
|||
if ($length != null) {
|
||||
$cols = $length;
|
||||
}
|
||||
$subContainer->addElement(new htmlInputTextarea($attrName . '_' . $i, $values[$i], $cols, 3));
|
||||
$textArea = new htmlInputTextarea($attrName . '_' . $i, $values[$i], $cols, 3);
|
||||
if (!empty($cssClasses)) {
|
||||
$textArea->setCSSClasses(array($cssClasses));
|
||||
}
|
||||
$subContainer->addElement($textArea);
|
||||
}
|
||||
if (!empty($htmlIDs)) {
|
||||
$htmlIDs[] = $attrName . '_' . $i;
|
||||
|
|
|
@ -145,7 +145,8 @@ class yubiKeyUser extends baseModule {
|
|||
return $return;
|
||||
}
|
||||
if (empty($objectClass) || in_array($objectClass, $this->attributes['objectClass'])) {
|
||||
$this->addMultiValueInputTextField($return, $attributeName, _('YubiKey ids'), false, '256', false, null, '50');
|
||||
$htmlIds = array();
|
||||
$this->addMultiValueInputTextField($return, $attributeName, _('YubiKey ids'), false, '12', false, null, null, $htmlIds, 'lam-prevent-enter');
|
||||
if (!empty($objectClass)) {
|
||||
$return->addElement(new htmlSpacer(null, '30px'), true);
|
||||
|
||||
|
|
|
@ -1100,6 +1100,17 @@ window.lam.html.activateLightboxes = function() {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Prevents enter key on input fields with class "lam-prevent-enter".
|
||||
*/
|
||||
window.lam.html.preventEnter = function() {
|
||||
jQuery('.lam-prevent-enter').keypress(function (event) {
|
||||
if (event.keyCode === 10 || event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.lam.selfservice = window.lam.selfservice || {};
|
||||
|
||||
/**
|
||||
|
@ -1161,4 +1172,5 @@ jQuery(document).ready(function() {
|
|||
window.lam.tools.setInitialFocus();
|
||||
window.lam.tools.schema.select();
|
||||
window.lam.html.activateLightboxes();
|
||||
window.lam.html.preventEnter();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue