From 906fcac43684222b1e86b5c6687d656a7aac498d Mon Sep 17 00:00:00 2001 From: Sheng Date: Sat, 16 Dec 2017 21:48:18 +0800 Subject: [PATCH] Check private key size before submission --- static/js/main.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index 5e3d569..aaa4ab1 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -5,14 +5,21 @@ jQuery(function($){ $('form#connect').submit(function(event) { event.preventDefault(); - status.text(''); - btn.prop('disabled', true); var form = $(this), url = form.attr('action'), type = form.attr('type'), data = new FormData(this); + var pk = data.get('privatekey'); + if (pk && pk.size > 16384) { + status.text('Key size exceeds maximum value.'); + return; + } + + status.text(''); + btn.prop('disabled', true); + $.ajax({ url: url, type: type,