change default for password attribute plaintext back to true, to not break every existing usage of that widget

This commit is contained in:
Ralf Becker 2020-06-16 08:37:51 +02:00
parent d7d5837ecf
commit 2c489ef5b8
5 changed files with 18 additions and 15 deletions

View File

@ -26,10 +26,10 @@
</row>
<row>
<description value="Password" for="account_passwd"/>
<passwd id="account_passwd" class="et2_fullWidth" onchange="app.addressbook.account_change" autocomplete="new-password" plaintext="true"/>
<passwd id="account_passwd" class="et2_fullWidth" onchange="app.addressbook.account_change" autocomplete="new-password"/>
<description/>
<description value="Re-enter password" for="account_passwd_2"/>
<passwd id="account_passwd_2" class="et2_fullWidth" onchange="app.addressbook.account_change" plaintext="true" suggest="0"/>
<passwd id="account_passwd_2" class="et2_fullWidth" onchange="app.addressbook.account_change" suggest="0"/>
<description/>
</row>
<row valign="top">

View File

@ -245,7 +245,7 @@ var et2_password = /** @class */ (function (_super) {
"plaintext": {
name: "Plaintext",
type: "boolean",
default: false,
default: true,
description: "Password is plaintext"
},
"suggest": {

View File

@ -46,7 +46,7 @@ export class et2_password extends et2_textbox
"plaintext": {
name: "Plaintext",
type: "boolean",
default: false,
default: true,
description: "Password is plaintext"
},
"suggest": {

View File

@ -38,10 +38,10 @@ var et2_core_valueWidget_1 = require("./et2_core_valueWidget");
*
* @augments et2_textbox
*/
var et2_url = /** @class */ (function (_super) {
__extends(et2_url, _super);
var et2_url = /** @class */ (function (_super_1) {
__extends(et2_url, _super_1);
function et2_url() {
var _this = _super !== null && _super.apply(this, arguments) || this;
var _this = _super_1 !== null && _super_1.apply(this, arguments) || this;
_this._button = null;
_this.value = "";
return _this;
@ -64,7 +64,7 @@ var et2_url = /** @class */ (function (_super) {
this.input.unbind();
}
this._button = null;
_super.prototype.destroy.call(this);
_super_1.prototype.destroy.call(this);
};
/**
* Override parent to update href of 'button'
@ -73,7 +73,7 @@ var et2_url = /** @class */ (function (_super) {
*/
et2_url.prototype.set_value = function (_value) {
this.update_button(_value);
_super.prototype.set_value.call(this, _value);
_super_1.prototype.set_value.call(this, _value);
};
et2_url.prototype.update_button = function (_value) {
if (this.value == _value)
@ -210,7 +210,7 @@ var et2_url = /** @class */ (function (_super) {
}
};
et2_url.prototype.attachToDOM = function () {
var res = _super.prototype.attachToDOM.call(this);
var res = _super_1.prototype.attachToDOM.call(this);
if (this.input[0].parentNode)
jQuery(this.input[0].parentNode).addClass('et2_url_span');
return res;
@ -265,8 +265,8 @@ et2_core_widget_1.et2_register_widget(et2_url, ["url", "url-email", "url-phone"]
*
* @augments et2_valueWidget
*/
var et2_url_ro = /** @class */ (function (_super) {
__extends(et2_url_ro, _super);
var et2_url_ro = /** @class */ (function (_super_1) {
__extends(et2_url_ro, _super_1);
/**
* Constructor
*
@ -275,7 +275,7 @@ var et2_url_ro = /** @class */ (function (_super) {
function et2_url_ro(_parent, _attrs, _child) {
var _this =
// Call the inherited constructor
_super.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_url_ro._attributes, _child || {})) || this;
_super_1.call(this, _parent, _attrs, et2_core_inheritance_1.ClassWithAttributes.extendAttributes(et2_url_ro._attributes, _child || {})) || this;
_this.value = "";
_this.span = null;
_this.value = "";

View File

@ -48,7 +48,8 @@ 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']);
$plaintext = !in_array(self::expand_name($this->attrs['plaintext'],$expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']),
['false', '0']);
if (!empty($value))
{
@ -78,7 +79,9 @@ 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']);
$plaintext = !in_array(self::expand_name($this->attrs['plaintext'],$expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']),
['false', '0']);
if (!$this->is_readonly($cname, $form_name))
{
$value = $value_in = self::get_array($content, $form_name);