From 631da62034621c846b9459248d7d16426c372cfd Mon Sep 17 00:00:00 2001 From: Tom Stock Date: Fri, 19 Feb 2021 13:29:24 +0100 Subject: [PATCH] Regex fix that failed to load cookie from store. The regex did not take into account that spaces around the cookie entries are possible. This fix remedies that by expanding the regex rule in the javascript. Further documentation: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie --- js/csrfprotector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/csrfprotector.js b/js/csrfprotector.js index ac58c55..cbe52b6 100644 --- a/js/csrfprotector.js +++ b/js/csrfprotector.js @@ -44,7 +44,7 @@ var CSRFP = { * @return {String} auth key from cookie. */ _getAuthKey: function () { - var regex = new RegExp(`(?:^|;\s*)${CSRFP.CSRFP_TOKEN}=([^;]+)(;|$)`); + var regex = new RegExp(`(?:^|;\s*|; \s*)${CSRFP.CSRFP_TOKEN}=([^;]+)(;|$)`); var regexResult = regex.exec(document.cookie); if (regexResult === null) { return null;