From 10418fdd154a20e3e4f6e9eab7ccd301f5197ded Mon Sep 17 00:00:00 2001 From: Marco R Date: Wed, 30 May 2018 09:41:28 +0200 Subject: [PATCH] Review formKey calculation for data validation cache With equally valued fields, the same key could be produced leading to misvalidations from the cache --- server/src/main/webapp/public/resources/js/main.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/src/main/webapp/public/resources/js/main.js b/server/src/main/webapp/public/resources/js/main.js index 8d2c04510..d9c5a894b 100644 --- a/server/src/main/webapp/public/resources/js/main.js +++ b/server/src/main/webapp/public/resources/js/main.js @@ -1218,8 +1218,8 @@ PWM_MAIN.pwmFormValidator = function(validationProps, reentrant) { // check if data is in cache, if it is just process it. var formData = readDataFunction(); - var formKey = ""; - for (var key in formData) {formKey += formData[key] + "-";} + var formDataString = JSON.stringify(formData) ; + var formKey = formDataString; { var cachedResult = PWM_VAR['validationCache'][formKey]; @@ -1263,8 +1263,6 @@ PWM_MAIN.pwmFormValidator = function(validationProps, reentrant) { }, 5); } - var formDataString = JSON.stringify(formData) ; - if (CONSOLE_DEBUG) console.log('FormValidator: sending form data to server... ' + formDataString); var loadFunction = function(data) { PWM_VAR['validationInProgress'] = false;