From 4316292ce706ba2aa0710dabfeb14733707021c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Thomas?= Date: Sat, 11 Feb 2017 00:55:26 +0100 Subject: [PATCH] Fix replaced CSRF token for shuffle radio For convenience, shuffle radio filters were saved and restored when loading the `more.view` page. This also happened for the `_csrf` field, which caused it to take an old and invalid value. --- .../src/main/webapp/WEB-INF/jsp/more.jsp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp b/libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp index f18cb442..69e614e5 100644 --- a/libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp +++ b/libresonic-main/src/main/webapp/WEB-INF/jsp/more.jsp @@ -62,6 +62,7 @@ } catch(e) { return; } elements = form.getElementsByTagName("input"); for (var i = 0; i < elements.length; i++) { + if (elements[i].type == "hidden") continue; if (elements[i].type == "submit") continue; if (data[elements[i].name]) elements[i].value = data[elements[i].name]; } @@ -87,9 +88,17 @@ var data = {} var elements = []; elements = form.getElementsByTagName("input"); - for (var i = 0; i < elements.length; i++) data[elements[i].name] = elements[i].value; + for (var i = 0; i < elements.length; i++) { + if (elements[i].type == "hidden") continue; + if (elements[i].type == "submit") continue; + data[elements[i].name] = elements[i].value; + } elements = form.getElementsByTagName("select"); - for (var i = 0; i < elements.length; i++) data[elements[i].name] = elements[i].value; + for (var i = 0; i < elements.length; i++) { + if (elements[i].type == "hidden") continue; + if (elements[i].type == "submit") continue; + data[elements[i].name] = elements[i].value; + } localStorage.setItem("randomPlayQueue", JSON.stringify(data)); }