Etemplate: Change default for password widget suggest to off

Customfields still default to on
This commit is contained in:
nathangray 2020-07-21 15:36:45 -06:00
parent f0b924008b
commit 32b061919f
5 changed files with 32 additions and 9 deletions

View File

@ -358,8 +358,15 @@ var et2_customfields_list = /** @class */ (function (_super) {
et2_customfields_list.prototype._setup_passwd = function (field_name, field, attrs) {
// No label on the widget itself
delete (attrs.label);
attrs['viewable'] = true;
attrs['plaintext'] = false;
var defaults = {
viewable: true,
plaintext: false,
suggest: 16
};
for (var _i = 0, _a = Object.keys(defaults); _i < _a.length; _i++) {
var key = _a[_i];
attrs[key] = (field.values && typeof field.values[key] !== "undefined") ? field.values[key] : defaults[key];
}
return true;
};
et2_customfields_list.prototype._setup_ajax_select = function (field_name, field, attrs) {

View File

@ -492,8 +492,16 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
{
// No label on the widget itself
delete (attrs.label);
attrs['viewable'] = true;
attrs['plaintext'] = false;
let defaults = {
viewable:true,
plaintext: false,
suggest: 16
};
for(let key of Object.keys(defaults))
{
attrs[key] = (field.values && typeof field.values[key] !== "undefined") ? field.values[key] : defaults[key];
}
return true;
}

View File

@ -251,7 +251,7 @@ var et2_password = /** @class */ (function (_super) {
"suggest": {
name: "Suggest password",
type: "integer",
default: 16,
default: 0,
description: "Suggest password length (0 for off)"
}
};

View File

@ -52,7 +52,7 @@ export class et2_password extends et2_textbox
"suggest": {
name: "Suggest password",
type: "integer",
default: 16,
default: 0,
description: "Suggest password length (0 for off)"
}
};

View File

@ -32,7 +32,7 @@ class Customfields extends Transformer
*/
protected static $cf_types = array(
'text' => 'Text',
'passwd' => 'Password',
'passwd' => 'Password',
'int' => 'Integer',
'float' => 'Float',
'label' => 'Label',
@ -324,8 +324,16 @@ class Customfields extends Transformer
case 'text':
break;
case 'passwd':
$widget->attrs['viewable'] = true;
$widget->attrs['plaintext'] = false;
// Defaults for a customfield are different than a regular password field
$defaults = Array(
'viewable' => true,
'plaintext' => false,
'suggest' => 16
);
foreach($defaults as $f => $d_value)
{
$widget->attrs[$f] = array_key_exists($f, $field['values']) ? $field['values'][$f] : $d_value;
}
break;
default: