From b3c2094cd2501c7f828edcd21ec9666680ef4839 Mon Sep 17 00:00:00 2001 From: Sheng Date: Sat, 10 Aug 2019 08:34:21 +0800 Subject: [PATCH] Only store values of the fields --- webssh/static/js/main.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js index 81633b8..9549ec9 100644 --- a/webssh/static/js/main.js +++ b/webssh/static/js/main.js @@ -649,9 +649,10 @@ jQuery(function($){ // use data from the arguments var form = document.querySelector(form_id), url = data.url || form.action, - _xsrf = form.querySelector('input[name="_xsrf"]'); + _xsrf = form.querySelector('input[name="_xsrf"]'), + data_wrapped = wrap_object(data); - var result = validate_form_data(wrap_object(data)); + var result = validate_form_data(data_wrapped); if (!result.valid) { console.log(result.msg); return; @@ -662,12 +663,7 @@ jQuery(function($){ data._origin = event_origin; } - for (var datum in data) { - var value = data[datum]; - if (value){ - window.localStorage.setItem(datum, value); - } - } + store_items(fields, data_wrapped); restore_items(fields); $.ajax({