From a80b5fdaaf3dc9e50a8d7a982cd3f9627078986b Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 30 Oct 2017 17:16:03 +0100 Subject: [PATCH] Prevent password form submission early Otherwise it might reload the page if we run in to some kind of error. --- app/ui.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/ui.js b/app/ui.js index 877a72e8..74735cce 100644 --- a/app/ui.js +++ b/app/ui.js @@ -1120,6 +1120,9 @@ var UI = { }, setPassword: function(e) { + // Prevent actually submitting the form + e.preventDefault(); + var inputElem = document.getElementById('noVNC_password_input'); var password = inputElem.value; // Clear the input after reading the password @@ -1128,8 +1131,6 @@ var UI = { UI.reconnect_password = password; document.getElementById('noVNC_password_dlg') .classList.remove('noVNC_open'); - // Prevent actually submitting the form - e.preventDefault(); }, /* ------^-------