Fix cookie name
authorLanius Trolling <lanius@laniustrolling.dev>
Mon, 12 Jun 2023 14:35:26 +0000 (10:35 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Mon, 12 Jun 2023 14:35:26 +0000 (10:35 -0400)
src/main/resources/static/init.js

index 08d7627c24767c705fca4a29595874219500eb48..0e5707b13b33948908f07e42353ae48a6bcfce25 100644 (file)
                        pElement.append(aElement);
                        document.currentScript.after(pElement);
                } else {
-                       document.cookie = "RedirectedFrom=" + window.location.pathname + "; SameSite=Lax; Secure";
+                       document.cookie = "REDIRECTED_FROM=" + window.location.pathname + "; SameSite=Lax; Secure";
                        window.location = redirectTo;
                }
        };
 
        window.checkRedirectTarget = function () {
-               const redirectSourceValues = document.cookie.split(';').filter(value => value.trim().startsWith("RedirectedFrom="));
+               const redirectSourceValues = document.cookie.split(';').filter(value => value.trim().startsWith("REDIRECTED_FROM="));
                if (redirectSourceValues.length > 0) {
-                       const redirectSource = new URL(redirectSourceValues[0].trim().substring("RedirectedFrom=".length), window.location.origin);
+                       const redirectSource = new URL(redirectSourceValues[0].trim().substring("REDIRECTED_FROM=".length), window.location.origin);
                        if (redirectSource.search.length > 0) {
                                redirectSource.search += "&redirect=no";
                        } else {
                        document.currentScript.after(pElement);
                }
 
-               document.cookie = "RedirectedFrom=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax; Secure";
+               document.cookie = "REDIRECTED_FROM=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax; Secure";
        };
 })();