Merged PR 2315: Auth stabilistatiion and hardening
Related work items: #23020
This commit is contained in:
@@ -169,20 +169,28 @@ export const addStatements = (options, ctx) => {
|
||||
};
|
||||
|
||||
export const addFinalComments = (options, ctx) => {
|
||||
const canSubmitFinalComments =
|
||||
const canSubmitFinalCommentsDefault =
|
||||
ctx.isSelectedAppellant ||
|
||||
ctx.isSelectedAgent ||
|
||||
ctx.isSelectedInterestedParty ||
|
||||
ctx.isLPA;
|
||||
|
||||
const canSubmitFinalComments = ctx.isDNS
|
||||
? ctx.isLPA
|
||||
: canSubmitFinalCommentsDefault;
|
||||
|
||||
const isSpecialistNonHearing =
|
||||
ctx.specialistProcess !== SPECIALIST_PROCESS.HEARING;
|
||||
|
||||
const finalCommentsWindowStart = ctx.isDNS
|
||||
? ctx.startDate
|
||||
: ctx.statementDueDate;
|
||||
|
||||
const canAdd =
|
||||
canSubmitFinalComments &&
|
||||
isWithinWindow(
|
||||
ctx.now,
|
||||
ctx.statementDueDate,
|
||||
finalCommentsWindowStart,
|
||||
ctx.finalCommentsDueDate
|
||||
) &&
|
||||
(ctx.appealType !== APPEAL_TYPES.HOUSEHOLDER || isSpecialistNonHearing);
|
||||
|
||||
+2
-10
@@ -7,7 +7,7 @@ import { connect } from "react-redux";
|
||||
import Banner from "../components/banner";
|
||||
import { setLogout } from "../store/accountDetails/action";
|
||||
|
||||
import { signOut } from "next-auth/react";
|
||||
import { performPortalSignOut } from "../lib/auth/sessionClient";
|
||||
|
||||
const Header = (props) => {
|
||||
let { t, lang } = useTranslation();
|
||||
@@ -84,15 +84,7 @@ const Header = (props) => {
|
||||
}
|
||||
|
||||
const handleLogout = () => {
|
||||
console.info("////////////\n" + "logout" + "\n////////////");
|
||||
(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: "/" }),
|
||||
signOut({
|
||||
callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout"
|
||||
}));
|
||||
performPortalSignOut(locale);
|
||||
};
|
||||
|
||||
//const switchLocale = locale === "en" ? "cy" : "en";
|
||||
|
||||
+2
-10
@@ -2,7 +2,6 @@ import { signOut } from "next-auth/react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { destroyCookie } from "nookies";
|
||||
import TimeOut from "../components/timeout";
|
||||
import AwaitingSubmissionFromBlob from "./myportal/awaitingsubmissionfromblob";
|
||||
|
||||
@@ -17,6 +16,7 @@ import MySubmittedReps from "./myportal/mysubmittedrepresentations";
|
||||
import ServiceBanner from "./myportal/servicebanner";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import transLookup from "../data/lookuptranslations.json";
|
||||
import { performPortalSignOut } from "../lib/auth/sessionClient";
|
||||
|
||||
const MyPortal = (props) => {
|
||||
const { showFileUpload, showLoginCheck, docsOffline } = props;
|
||||
@@ -26,15 +26,7 @@ const MyPortal = (props) => {
|
||||
const { locale } = router;
|
||||
|
||||
const handleLogout = () => {
|
||||
console.info("////////////\n" + "logout" + "\n////////////");
|
||||
(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: "/" }),
|
||||
signOut({
|
||||
callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout"
|
||||
}));
|
||||
performPortalSignOut({ locale, signOutFn: signOut });
|
||||
};
|
||||
|
||||
const isLPA =
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import router from "next/router";
|
||||
import Link from "next/link";
|
||||
import { destroyCookie } from "nookies";
|
||||
import { signOut } from "next-auth/react";
|
||||
import { performPortalSignOut } from "../../lib/auth/sessionClient";
|
||||
|
||||
const ServiceBanner = (props) => {
|
||||
props = props.props;
|
||||
@@ -19,23 +18,14 @@ const ServiceBanner = (props) => {
|
||||
};
|
||||
|
||||
const handleLogout = (locale) => {
|
||||
console.info("////////////\n" + "logout" + "\n////////////");
|
||||
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: "/" }),
|
||||
signOut({
|
||||
callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout",
|
||||
});
|
||||
performPortalSignOut(locale);
|
||||
};
|
||||
|
||||
const portalLogoLink = [
|
||||
"/myportal/[appealtypes]",
|
||||
"/newappeal",
|
||||
"/newappeal/[appealtypes]",
|
||||
"/myportal/representation",
|
||||
"/myportal/representation"
|
||||
];
|
||||
return (
|
||||
<div className="servicebanner myportal govuk-!-margin-bottom-4">
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { signOut } from "next-auth/react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import { destroyCookie } from "nookies";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useIdleTimer } from "react-idle-timer";
|
||||
import TimeoutModal from "./timeoutmodal";
|
||||
import { performPortalSignOut } from "../../lib/auth/sessionClient";
|
||||
|
||||
const TimeOut = (props) => {
|
||||
let { t } = useTranslation();
|
||||
@@ -20,15 +19,7 @@ const TimeOut = (props) => {
|
||||
|
||||
const onIdle = () => {
|
||||
setState("Idle");
|
||||
console.info("////////////\n" + "logout" + "\n////////////");
|
||||
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: "/" }),
|
||||
signOut({
|
||||
callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout",
|
||||
});
|
||||
performPortalSignOut(locale);
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
@@ -48,7 +39,7 @@ const TimeOut = (props) => {
|
||||
onPrompt,
|
||||
timeout,
|
||||
promptBeforeIdle,
|
||||
throttle: 500,
|
||||
throttle: 500
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -89,14 +80,14 @@ const TimeOut = (props) => {
|
||||
<div
|
||||
className={open ? "modal fade show" : "modal fade"}
|
||||
style={{
|
||||
display: open ? "flex" : "none",
|
||||
display: open ? "flex" : "none"
|
||||
}}
|
||||
>
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
<h3>
|
||||
{t("common:login-modal-message", {
|
||||
remaining: remaining,
|
||||
remaining: remaining
|
||||
})}
|
||||
</h3>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user