Skip to content

Commit

Permalink
Item14901: fix to allow clearing XML and CERT types
Browse files Browse the repository at this point in the history
  • Loading branch information
timlegge committed Apr 17, 2020
1 parent b55354e commit 1df774a
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions ConfigurePlugin/pub/System/ConfigurePlugin/types.uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,18 @@ var Types = {};
}
return this._super(function(evt) {
var val = $(this).val().trim();
var oParser = new DOMParser();
var oDOM = oParser.parseFromString(val, "text/xml");
if (!(oDOM.getElementsByTagName('parsererror').length)) {
$(this).css('background-color', '');
$(this).val(val);
change_handler.call(this, evt);
} else {
$(this).css('background-color', 'yellow');
alert('"' + val + '" is not a valid XML document');
}
if (val != '') {
var oParser = new DOMParser();
var oDOM = oParser.parseFromString(val, "text/xml");
if (!(oDOM.getElementsByTagName('parsererror').length)) {
$(this).css('background-color', '');
$(this).val(val);
change_handler.call(this, evt);
} else {
$(this).css('background-color', 'yellow');
alert('"' + val + '" is not a valid XML document');
}
}
});
},

Expand All @@ -304,15 +306,17 @@ var Types = {};
}
return this._super(function(evt) {
var val = $(this).val().trim();
if ((/^-----BEGIN CERTIFICATE-----[\s\S]*-----END CERTIFICATE-----$/.test(val)) ||
(/^-----BEGIN PRIVATE KEY-----[\s\S]*-----END PRIVATE KEY-----$/.test(val))) {
$(this).css('background-color', '');
$(this).val(val);
change_handler.call(this, evt);
} else {
$(this).css('background-color', 'yellow');
alert('"' + val + '" is not a valid base64 encoded certificate');
}
if (val != '') {
if ((/^-----BEGIN CERTIFICATE-----[\s\S]*-----END CERTIFICATE-----$/.test(val)) ||
(/^-----BEGIN PRIVATE KEY-----[\s\S]*-----END PRIVATE KEY-----$/.test(val))) {
$(this).css('background-color', '');
$(this).val(val);
change_handler.call(this, evt);
} else {
$(this).css('background-color', 'yellow');
alert('"' + val + '" is not a valid base64 encoded certificate');
}
}
});
},

Expand Down

0 comments on commit 1df774a

Please sign in to comment.