Merged PR 2315: Auth stabilistatiion and hardening
Related work items: #23020
This commit is contained in:
+4
-8
@@ -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 }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user