From b6e47f9b11e3110e93a3daf86a621b879f7169be Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 23 Jul 2020 13:56:14 -0600 Subject: [PATCH] Etemplate: Password widget now auto-updates the second 'confirm' password if you have two and suggest a password. --- addressbook/js/app.js | 10 ---------- addressbook/js/app.ts | 11 ----------- api/js/etemplate/et2_widget_password.js | 7 +++++++ api/js/etemplate/et2_widget_password.ts | 9 +++++++++ 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/addressbook/js/app.js b/addressbook/js/app.js index d8000d19f8..844ddc5422 100644 --- a/addressbook/js/app.js +++ b/addressbook/js/app.js @@ -906,16 +906,6 @@ var AddressbookApp = /** @class */ (function (_super) { AddressbookApp.prototype.account_change = function (_ev, _widget) { switch (_widget.id) { case 'account_passwd': - debugger; - // If they clicked suggest, copy it to password 2 - if (_widget && _widget.options.viewable) { - var p2 = _widget.getParent().getWidgetById('account_passwd_2'); - p2.set_viewable(true); // Allow viewing password - p2.toggle_visibility(true); // Actually show it - p2.set_value(_widget.getValue()); - _widget.options.viewable = false; - } - // Fall through case 'account_lid': case 'n_family': case 'n_given': diff --git a/addressbook/js/app.ts b/addressbook/js/app.ts index 882c752f67..45e906fd8a 100644 --- a/addressbook/js/app.ts +++ b/addressbook/js/app.ts @@ -1102,17 +1102,6 @@ class AddressbookApp extends EgwApp switch(_widget.id) { case 'account_passwd': - debugger; - // If they clicked suggest, copy it to password 2 - if(_widget && _widget.options.viewable) - { - let p2 = _widget.getParent().getWidgetById('account_passwd_2'); - p2.set_viewable(true); // Allow viewing password - p2.toggle_visibility(true); // Actually show it - p2.set_value(_widget.getValue()); - _widget.options.viewable = false; - } - // Fall through case 'account_lid': case 'n_family': case 'n_given': diff --git a/api/js/etemplate/et2_widget_password.js b/api/js/etemplate/et2_widget_password.js index a9b14e1a6e..c92d4b3ab7 100644 --- a/api/js/etemplate/et2_widget_password.js +++ b/api/js/etemplate/et2_widget_password.js @@ -221,6 +221,13 @@ var et2_password = /** @class */ (function (_super) { this.encrypted = false; this.input.val(suggestion); this.input.trigger('change'); + // Check for second password, update it too + var two = this.getParent().getWidgetById(this.id + '_2'); + if (two && two.getType() == this.getType()) { + two.options.viewable = true; + two.toggle_visibility(true); + two.set_value(suggestion); + } }, this, true, this).sendRequest(); }; et2_password.prototype.destroy = function () { diff --git a/api/js/etemplate/et2_widget_password.ts b/api/js/etemplate/et2_widget_password.ts index 3b7016d6ce..ba1483b7d0 100644 --- a/api/js/etemplate/et2_widget_password.ts +++ b/api/js/etemplate/et2_widget_password.ts @@ -300,6 +300,15 @@ export class et2_password extends et2_textbox this.encrypted = false; this.input.val(suggestion); this.input.trigger('change'); + + // Check for second password, update it too + let two = this.getParent().getWidgetById(this.id+'_2'); + if(two && two.getType() == this.getType()) + { + two.options.viewable = true; + two.toggle_visibility(true); + two.set_value(suggestion); + } }, this,true,this ).sendRequest();