Try to prevent auto-fill of password fields in node edit tray

Fixes #1081
This commit is contained in:
Nick O'Leary 2017-01-08 23:14:14 +00:00
parent 3c96218338
commit 4562b06a60
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 5 additions and 1 deletions

View File

@ -529,7 +529,7 @@ RED.editor = (function() {
function buildEditForm(tray,formId,type,ns) {
var trayBody = tray.find('.editor-tray-body');
var dialogForm = $('<form id="'+formId+'" class="form-horizontal"></form>').appendTo(trayBody);
var dialogForm = $('<form id="'+formId+'" class="form-horizontal" autocomplete="off"></form>').appendTo(trayBody);
dialogForm.html($("script[data-template-name='"+type+"']").html());
ns = ns||"node-red";
dialogForm.find('[data-i18n]').each(function() {
@ -549,6 +549,10 @@ RED.editor = (function() {
}
$(this).attr("data-i18n",keys.join(";"));
});
// Add dummy fields to prevent 'Enter' submitting the form in some
// cases, and also prevent browser auto-fill of password
// Add in reverse order as they are prepended...
$('<input type="password" style="display: none;" />').prependTo(dialogForm);
$('<input type="text" style="display: none;" />').prependTo(dialogForm);
dialogForm.submit(function(e) { e.preventDefault();});
return dialogForm;