From b56a8f9901eb211148af7f7e4bebc954052a7e9f Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 16 Jun 2020 09:23:54 -0600 Subject: [PATCH] Default password customfield plaintext attribute to false --- api/js/etemplate/et2_extension_customfields.js | 1 + api/js/etemplate/et2_extension_customfields.ts | 1 + api/js/etemplate/et2_widget_password.js | 12 ++++++++++++ api/js/etemplate/et2_widget_password.ts | 12 +++++++++++- api/src/Etemplate/Widget/Customfields.php | 1 + 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_extension_customfields.js b/api/js/etemplate/et2_extension_customfields.js index d7564c7032..cf1c8746d0 100644 --- a/api/js/etemplate/et2_extension_customfields.js +++ b/api/js/etemplate/et2_extension_customfields.js @@ -358,6 +358,7 @@ var et2_customfields_list = /** @class */ (function (_super) { // No label on the widget itself delete (attrs.label); attrs['viewable'] = true; + attrs['plaintext'] = false; 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 4c7a050b84..6c1b9c3606 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -485,6 +485,7 @@ 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; return true; } diff --git a/api/js/etemplate/et2_widget_password.js b/api/js/etemplate/et2_widget_password.js index 34410a0b79..ce4e97565a 100644 --- a/api/js/etemplate/et2_widget_password.js +++ b/api/js/etemplate/et2_widget_password.js @@ -260,4 +260,16 @@ var et2_password = /** @class */ (function (_super) { }(et2_widget_textbox_1.et2_textbox)); exports.et2_password = et2_password; et2_core_widget_1.et2_register_widget(et2_password, ["passwd"]); +var et2_password_ro = /** @class */ (function (_super) { + __extends(et2_password_ro, _super); + function et2_password_ro() { + return _super !== null && _super.apply(this, arguments) || this; + } + et2_password_ro.prototype.set_value = function (value) { + this.value_span.text(value ? "********" : ""); + }; + return et2_password_ro; +}(et2_widget_textbox_1.et2_textbox_ro)); +exports.et2_password_ro = et2_password_ro; +et2_core_widget_1.et2_register_widget(et2_password_ro, ["passwd_ro"]); //# sourceMappingURL=et2_widget_password.js.map \ No newline at end of file diff --git a/api/js/etemplate/et2_widget_password.ts b/api/js/etemplate/et2_widget_password.ts index 57bf986fcf..cb361bf625 100644 --- a/api/js/etemplate/et2_widget_password.ts +++ b/api/js/etemplate/et2_widget_password.ts @@ -20,7 +20,7 @@ import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_wi import {et2_valueWidget} from './et2_core_valueWidget' import {et2_inputWidget} from './et2_core_inputWidget' import {et2_button} from './et2_widget_button' -import {et2_textbox} from "./et2_widget_textbox"; +import {et2_textbox, et2_textbox_ro} from "./et2_widget_textbox"; import {et2_dialog} from "./et2_widget_dialog"; /** @@ -316,3 +316,13 @@ export class et2_password extends et2_textbox } } et2_register_widget(et2_password, [ "passwd"]); + + +export class et2_password_ro extends et2_textbox_ro +{ + set_value(value) + { + this.value_span.text(value ? "********" : ""); + } +} +et2_register_widget(et2_password_ro, [ "passwd_ro"]); \ No newline at end of file diff --git a/api/src/Etemplate/Widget/Customfields.php b/api/src/Etemplate/Widget/Customfields.php index f7774413d0..917498c176 100644 --- a/api/src/Etemplate/Widget/Customfields.php +++ b/api/src/Etemplate/Widget/Customfields.php @@ -325,6 +325,7 @@ class Customfields extends Transformer break; case 'passwd': $widget->attrs['viewable'] = true; + $widget->attrs['plaintext'] = false; break; default: