diff --git a/addressbook/js/app.js b/addressbook/js/app.js
index 336a0c04d6..d8000d19f8 100644
--- a/addressbook/js/app.js
+++ b/addressbook/js/app.js
@@ -905,10 +905,20 @@ 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':
- case 'account_passwd':
case 'account_passwd_2':
var values = this.et2._inst.getValues(this.et2);
var data = {
diff --git a/addressbook/js/app.ts b/addressbook/js/app.ts
index 0678161c30..882c752f67 100644
--- a/addressbook/js/app.ts
+++ b/addressbook/js/app.ts
@@ -1101,10 +1101,21 @@ 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':
- case 'account_passwd':
case 'account_passwd_2':
var values = this.et2._inst.getValues(this.et2);
var data = {
diff --git a/admin/templates/default/account.xet b/admin/templates/default/account.xet
index d5eea38fbd..3a583b1158 100644
--- a/admin/templates/default/account.xet
+++ b/admin/templates/default/account.xet
@@ -26,10 +26,10 @@
-
+
-
+
diff --git a/api/js/etemplate/et2_widget_password.js b/api/js/etemplate/et2_widget_password.js
index 98ec03088e..904692feac 100644
--- a/api/js/etemplate/et2_widget_password.js
+++ b/api/js/etemplate/et2_widget_password.js
@@ -49,6 +49,9 @@ var et2_password = /** @class */ (function (_super) {
// The password is stored encrypted server side, and passed encrypted.
// This flag is for if we've decrypted the password to show it already
_this.encrypted = true;
+ if (_this.options.plaintext) {
+ _this.encrypted = false;
+ }
return _this;
}
et2_password.prototype.createInputWidget = function () {
@@ -217,6 +220,7 @@ var et2_password = /** @class */ (function (_super) {
var request = egw.json("EGroupware\\Api\\Etemplate\\Widget\\Password::ajax_suggest", [this.options.suggest], function (suggestion) {
this.encrypted = false;
this.input.val(suggestion);
+ this.input.trigger('change');
}, this, true, this).sendRequest();
};
et2_password.prototype.destroy = function () {
@@ -238,6 +242,12 @@ var et2_password = /** @class */ (function (_super) {
"default": false,
"description": "Allow password to be shown"
},
+ "plaintext": {
+ name: "Plaintext",
+ type: "boolean",
+ default: false,
+ description: "Password is plaintext"
+ },
"suggest": {
name: "Suggest password",
type: "integer",
diff --git a/api/js/etemplate/et2_widget_password.ts b/api/js/etemplate/et2_widget_password.ts
index f7c7827f0a..be6274ca21 100644
--- a/api/js/etemplate/et2_widget_password.ts
+++ b/api/js/etemplate/et2_widget_password.ts
@@ -43,6 +43,12 @@ export class et2_password extends et2_textbox
"default": false,
"description": "Allow password to be shown"
},
+ "plaintext": {
+ name: "Plaintext",
+ type: "boolean",
+ default: false,
+ description: "Password is plaintext"
+ },
"suggest": {
name: "Suggest password",
type: "integer",
@@ -68,6 +74,10 @@ export class et2_password extends et2_textbox
// Call the inherited constructor
super(_parent, _attrs, ClassWithAttributes.extendAttributes(et2_password._attributes, _child || {}));
+ if(this.options.plaintext)
+ {
+ this.encrypted = false;
+ }
}
createInputWidget()
@@ -289,6 +299,7 @@ export class et2_password extends et2_textbox
function(suggestion) {
this.encrypted = false;
this.input.val(suggestion);
+ this.input.trigger('change');
},
this,true,this
).sendRequest();
diff --git a/api/src/Etemplate/Widget/Password.php b/api/src/Etemplate/Widget/Password.php
index ecbe69557b..fb1ce7519a 100644
--- a/api/src/Etemplate/Widget/Password.php
+++ b/api/src/Etemplate/Widget/Password.php
@@ -48,12 +48,14 @@ class Password extends Etemplate\Widget\Textbox
{
$form_name = self::form_name($cname, $this->id, $expand);
$value =& self::get_array(self::$request->content, $form_name);
+ $plaintext = 'true' == self::expand_name($this->attrs['plaintext'],$expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']);
+
if (!empty($value))
{
$preserv =& self::get_array(self::$request->preserv, $form_name, true);
$preserv = (string)$value;
- if (!empty($value) && array_key_exists('viewable', $this->attrs) && $this->attrs['viewable'] == 'false')
+ if (!empty($value) && ((array_key_exists('viewable', $this->attrs) && $this->attrs['viewable'] === 'false') || $plaintext))
{
$value = str_repeat('*', strlen($preserv));
}
@@ -76,7 +78,7 @@ class Password extends Etemplate\Widget\Textbox
public function validate($cname, array $expand, array $content, &$validated=array())
{
$form_name = self::form_name($cname, $this->id, $expand);
-
+ $plaintext = 'true' == self::expand_name($this->attrs['plaintext'],$expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']);
if (!$this->is_readonly($cname, $form_name))
{
$value = $value_in = self::get_array($content, $form_name);
@@ -88,12 +90,12 @@ class Password extends Etemplate\Widget\Textbox
{
$value = $preserv;
}
- else if ($value_in == Credentials::decrypt(array('cred_password' => $preserv,'cred_pw_enc' => Credentials::SYSTEM_AES)))
+ else if (!$plaintext && $preserv && $value_in == Credentials::decrypt(array('cred_password' => $preserv,'cred_pw_enc' => Credentials::SYSTEM_AES)))
{
// Don't change if they submitted the decrypted version
$value = $preserv;
}
- else if ($value_in !== $preserv)
+ else if (!$plaintext && $value_in !== $preserv)
{
// Store encrypted
$encryption = null;