Merged PR 2315: Auth stabilistatiion and hardening

Related work items: #23020
This commit is contained in:
Robert Bond
2026-05-14 08:55:49 +00:00
parent d295a507ac
commit d0b2fd077a
41 changed files with 1462 additions and 418 deletions
+4 -8
View File
@@ -7,10 +7,10 @@ import CookieBanner from "../../components/cookieBanner";
import Footer from "../../components/footer";
import Header from "../../components/header";
import ServiceBanner from "../../components/servicebanner";
import { destroyCookie, setCookie } from "nookies";
import { useEffect } from "react";
import { getCsrfToken } from "next-auth/react";
import { clearSessionArtifacts } from "../../lib/auth/sessionClient";
const Error = (props) => {
let { t, lang } = useTranslation();
@@ -19,11 +19,7 @@ const Error = (props) => {
const { error } = useRouter().query;
useEffect(() => {
window.localStorage.clear(),
destroyCookie(null, "next-auth.csrf-token", { path: "/" }),
destroyCookie(null, "next-auth.callback-url", { path: "/" }),
destroyCookie(null, "pedw_locale", { path: "/" }),
destroyCookie(null, "pinsUser", { path: "/" });
clearSessionArtifacts();
}, []);
const errors = {
@@ -37,7 +33,7 @@ const Error = (props) => {
EmailSignin: t("auth:auth-error-EmailSignin-label"),
CredentialsSignin: t("auth:auth-error-CredentialsSignin-label"),
Verification: t("auth:auth-error-Verification-label"),
default: t("auth:auth-error-default-label"),
default: t("auth:auth-error-default-label")
};
const errorMessage = error && (errors[error] ?? errors.default);
@@ -89,7 +85,7 @@ const Error = (props) => {
export async function getServerSideProps(context) {
const csrfToken = await getCsrfToken(context);
return {
props: { csrfToken },
props: { csrfToken }
};
}