From a6dd6854e4b8d0063ebf4628cf5ae039d1d6994c Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 14 Nov 2021 19:37:14 +0100 Subject: [PATCH] fix issue #77 --- lib/Controller/PersonalSettingController.php | 1 + src/admin.js | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Controller/PersonalSettingController.php b/lib/Controller/PersonalSettingController.php index 99bc65a..90fb758 100644 --- a/lib/Controller/PersonalSettingController.php +++ b/lib/Controller/PersonalSettingController.php @@ -54,6 +54,7 @@ class PersonalSettingController extends Controller /** * @NoAdminRequired + * @NoCSRFRequired * * @param mixed $name * @param mixed $value diff --git a/src/admin.js b/src/admin.js index 3058e24..92d1948 100644 --- a/src/admin.js +++ b/src/admin.js @@ -21,16 +21,17 @@ const selector = '#side-menu-message' const userConfig = (name, value, callbacks) => { const url = OC.generateUrl('/apps/side_menu/personalSetting/valueSet') - const formData = new FormData() - formData.append('name', name) - formData.append('value', value) + const formData = [] + + formData.push('name=' + encodeURIComponent(name)) + formData.push('value=' + encodeURIComponent(value)) fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, - body: formData + body: formData.join('&') }) .then(callbacks.success) .catch(callbacks.error)