1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

View File

@ -529,7 +529,7 @@ RED.editor = (function() {
function buildEditForm(tray,formId,type,ns) { function buildEditForm(tray,formId,type,ns) {
var trayBody = tray.find('.editor-tray-body'); 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()); dialogForm.html($("script[data-template-name='"+type+"']").html());
ns = ns||"node-red"; ns = ns||"node-red";
dialogForm.find('[data-i18n]').each(function() { dialogForm.find('[data-i18n]').each(function() {
@ -549,6 +549,10 @@ RED.editor = (function() {
} }
$(this).attr("data-i18n",keys.join(";")); $(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); $('<input type="text" style="display: none;" />').prependTo(dialogForm);
dialogForm.submit(function(e) { e.preventDefault();}); dialogForm.submit(function(e) { e.preventDefault();});
return dialogForm; return dialogForm;