diff --git a/api/js/etemplate/et2_extension_customfields.js b/api/js/etemplate/et2_extension_customfields.js index fe5e76bb7e..ce2ef9e254 100644 --- a/api/js/etemplate/et2_extension_customfields.js +++ b/api/js/etemplate/et2_extension_customfields.js @@ -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) { diff --git a/api/js/etemplate/et2_extension_customfields.ts b/api/js/etemplate/et2_extension_customfields.ts index 0d86ce99b2..34207a96df 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -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; } diff --git a/api/js/etemplate/et2_widget_password.js b/api/js/etemplate/et2_widget_password.js index ce4e97565a..a9b14e1a6e 100644 --- a/api/js/etemplate/et2_widget_password.js +++ b/api/js/etemplate/et2_widget_password.js @@ -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)" } }; diff --git a/api/js/etemplate/et2_widget_password.ts b/api/js/etemplate/et2_widget_password.ts index cb361bf625..3b7016d6ce 100644 --- a/api/js/etemplate/et2_widget_password.ts +++ b/api/js/etemplate/et2_widget_password.ts @@ -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)" } }; diff --git a/api/src/Etemplate/Widget/Customfields.php b/api/src/Etemplate/Widget/Customfields.php index 917498c176..8311fd6bab 100644 --- a/api/src/Etemplate/Widget/Customfields.php +++ b/api/src/Etemplate/Widget/Customfields.php @@ -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: