inactivy tyling and time out time
This commit is contained in:
@@ -207,6 +207,54 @@ let Login = (props) => {
|
|||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("home:login-card-title")}
|
{t("home:login-card-title")}
|
||||||
</h3>{" "}
|
</h3>{" "}
|
||||||
|
{/* <form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
|
{validLoginID == false && (
|
||||||
|
<div className="govuk-error-message govuk-form-group--error">
|
||||||
|
Incorrect username or password
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<Field
|
||||||
|
// validate={[
|
||||||
|
// required(
|
||||||
|
// t("home:casesearch-search-validation-required")
|
||||||
|
// ),
|
||||||
|
// minLength(
|
||||||
|
// t("home:casesearch-search-validation-minlength")
|
||||||
|
// ),
|
||||||
|
// ]}
|
||||||
|
className="govuk-input"
|
||||||
|
component={RenderTextfield}
|
||||||
|
id="loginUserID"
|
||||||
|
name="loginUserID"
|
||||||
|
type="text"
|
||||||
|
aria-describedby="basicSearch-hint"
|
||||||
|
hint1={t("home:login-card-id-label")}
|
||||||
|
label={t("home:login-card-id-hint")}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Field
|
||||||
|
// validate={[
|
||||||
|
// required(
|
||||||
|
// t("home:casesearch-search-validation-required")
|
||||||
|
// ),
|
||||||
|
// minLength(
|
||||||
|
// t("home:casesearch-search-validation-minlength")
|
||||||
|
// ),
|
||||||
|
// ]}
|
||||||
|
className="govuk-input"
|
||||||
|
component={RenderPasswordfield}
|
||||||
|
id="loginUserPassword"
|
||||||
|
name="loginUserPassword"
|
||||||
|
type="password"
|
||||||
|
label="Password"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="govuk-form-group">
|
||||||
|
<button type="submit" className="govuk-button">
|
||||||
|
{t("home:login-card-button")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form> */}
|
||||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
<div className="govuk-form-group govuk-!-margin-top-4">
|
||||||
<p className="govuk-body-xs">
|
<p className="govuk-body-xs">
|
||||||
<a
|
<a
|
||||||
|
|||||||
+13
-14
@@ -22,30 +22,26 @@ const MyPortal = (props) => {
|
|||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
const inactiveTimeOut = 120; // in seconds
|
||||||
|
const reminderTimeout = 30; // in seconds
|
||||||
|
|
||||||
let idleTimer = null;
|
let idleTimer = null;
|
||||||
let logoutTimer = null;
|
let logoutTimer = null;
|
||||||
|
|
||||||
let shareState = () => {
|
let onIdle = () => {
|
||||||
showShareState == true
|
|
||||||
? setShowShareState(false)
|
|
||||||
: setShowShareState(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onIdle = () => {
|
|
||||||
togglePopup();
|
togglePopup();
|
||||||
logoutTimer = setTimeout(() => {
|
logoutTimer = setTimeout(() => {
|
||||||
handleLogout();
|
handleLogout();
|
||||||
}, 1000 * 5 * 1); // 5 seconds
|
}, 1000 * reminderTimeout * 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const togglePopup = () => {
|
let togglePopup = () => {
|
||||||
showModal == true ? setShowModal(false) : setShowModal(true);
|
showModal == true ? setShowModal(false) : setShowModal(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleStayLoggedIn = () => {
|
let handleStayLoggedIn = () => {
|
||||||
if (logoutTimer) {
|
if (logoutTimer) {
|
||||||
clearTimeout(this.logoutTimer);
|
clearTimeout(logoutTimer);
|
||||||
logoutTimer = null;
|
logoutTimer = null;
|
||||||
}
|
}
|
||||||
idleTimer.reset();
|
idleTimer.reset();
|
||||||
@@ -53,6 +49,7 @@ const MyPortal = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
|
console.log("////////////", "\n", "logout", "\n", "//////////");
|
||||||
destroyCookie({}, "pinsUser"),
|
destroyCookie({}, "pinsUser"),
|
||||||
window.localStorage.clear(),
|
window.localStorage.clear(),
|
||||||
router.replace(props.ggLogout);
|
router.replace(props.ggLogout);
|
||||||
@@ -127,21 +124,23 @@ const MyPortal = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
{/* <IdleTimer
|
<IdleTimer
|
||||||
ref={(ref) => {
|
ref={(ref) => {
|
||||||
idleTimer = ref;
|
idleTimer = ref;
|
||||||
}}
|
}}
|
||||||
element={document}
|
element={document}
|
||||||
stopOnIdle={true}
|
stopOnIdle={true}
|
||||||
|
onActive={console.log(" bbis active", idleTimer)}
|
||||||
onIdle={onIdle}
|
onIdle={onIdle}
|
||||||
timeout={1000 * 600 * 1} // 10 seconds
|
timeout={1000 * inactiveTimeOut * 1}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TimeoutModal
|
<TimeoutModal
|
||||||
|
remainingCountdown={reminderTimeout}
|
||||||
showModal={showModal}
|
showModal={showModal}
|
||||||
togglePopup={togglePopup}
|
togglePopup={togglePopup}
|
||||||
handleStayLoggedIn={handleStayLoggedIn}
|
handleStayLoggedIn={handleStayLoggedIn}
|
||||||
/> */}
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
+11
-15
@@ -1,22 +1,18 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
|
const TimeoutModal = (props) => {
|
||||||
|
const { showModal, handleStayLoggedIn, remainingCountdown } = props;
|
||||||
|
|
||||||
const TimeoutModal = ({ showModal, togglePopup, handleStayLoggedIn }) => {
|
|
||||||
return (
|
return (
|
||||||
<div className="modal">
|
<div className={showModal == false ? "modal fade" : "modal fade show"}>
|
||||||
<div
|
<div backdrop="static" className="modal-dialog">
|
||||||
isOpen={showModal}
|
|
||||||
toggle={togglePopup}
|
|
||||||
keyboard={false}
|
|
||||||
backdrop="static"
|
|
||||||
className="modal-dialog"
|
|
||||||
>
|
|
||||||
<div className="modal-content">
|
<div className="modal-content">
|
||||||
<h1>
|
<h3>
|
||||||
{" "}
|
Your session is about to expire in {remainingCountdown}{" "}
|
||||||
timeout - Your session is about to expire in 5 seconds
|
seconds due to inactivity. You will be redirected to the
|
||||||
due to inactivity. You will be redirected to the login
|
login page.
|
||||||
page.
|
</h3>
|
||||||
</h1>
|
|
||||||
<button
|
<button
|
||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
onClick={handleStayLoggedIn}
|
onClick={handleStayLoggedIn}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"gov-wales-link": "https://www.gov.wales",
|
"gov-wales-link": "https://www.gov.wales",
|
||||||
"gov-wales-label": "GOV.WALES",
|
"gov-wales-label": "GOV.WALES",
|
||||||
"service-description": "This service is being developed to support online appeals and applications.",
|
"service-description": "This service is being developed to support online appeals and applications.",
|
||||||
"service-name": "Casework",
|
"service-name": "Planning Casework",
|
||||||
"service-home-url": "https://planningcasework.service.gov.wales",
|
"service-home-url": "https://planningcasework.service.gov.wales",
|
||||||
"service-name-breadcrumb": "Home",
|
"service-name-breadcrumb": "Home",
|
||||||
"new-service-beta": "This is a new service",
|
"new-service-beta": "This is a new service",
|
||||||
|
|||||||
@@ -1720,6 +1720,10 @@ ul#sharePageLinks.active {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
|
top: 30%;
|
||||||
|
@media screen and (min-width: 768px) {
|
||||||
|
top: 35%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fade {
|
fade {
|
||||||
@@ -1751,23 +1755,30 @@ fade {
|
|||||||
|
|
||||||
.modal-dialog {
|
.modal-dialog {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: auto;
|
width: 80%;
|
||||||
margin: 0.5rem;
|
margin: auto 1rem;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
z-index: 1050;
|
||||||
|
@media screen and (min-width: 768px) {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 576px) {
|
@media (min-width: 576px) {
|
||||||
.modal-dialog {
|
.modal-dialog {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
margin: 1.75rem auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal.fade.show {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
.modal.show .modal-dialog {
|
.modal.show .modal-dialog {
|
||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
.modal.fade .modal-dialog {
|
.modal.fade .modal-dialog {
|
||||||
transition: transform 0.3s ease-out;
|
transition: transform 0.3s ease-out;
|
||||||
transform: translate(0, -50px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
@@ -1781,6 +1792,8 @@ fade {
|
|||||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||||
border-radius: 0.3rem;
|
border-radius: 0.3rem;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
|
padding: 20px;
|
||||||
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-footer {
|
.modal-footer {
|
||||||
|
|||||||
Reference in New Issue
Block a user