From 02fbdab78deed3a11c338b3cec18a5dd757b81f5 Mon Sep 17 00:00:00 2001 From: Sheng Date: Wed, 7 Feb 2018 07:40:17 +0800 Subject: [PATCH] Check form data required before submission --- static/js/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/js/main.js b/static/js/main.js index 629c88e..21b1d27 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -11,6 +11,11 @@ jQuery(function($){ type = form.attr('type'), data = new FormData(this); + if (!data.get('hostname') || !data.get('port') || !data.get('username')) { + status.text('Hostname, port and username are required.'); + return; + } + var pk = data.get('privatekey'); if (pk && pk.size > 16384) { status.text('Key size exceeds maximum value.');