- added 'maintenance' state logic;
This commit is contained in:
@@ -38,6 +38,10 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&[disabled] {
|
||||
background: var(--message-info-background);
|
||||
}
|
||||
|
||||
span {
|
||||
color: #FFF;
|
||||
font-size: 17.25px;
|
||||
|
||||
@@ -25,17 +25,18 @@ const Login = () => {
|
||||
const errorMsgs = useRef(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [visibleCacheFaq, setVisibleCacheFaq] = useState(false);
|
||||
const [isMaintenance] = useState(true);
|
||||
let [searchParams] = useSearchParams();
|
||||
const { origin } = window.location;
|
||||
|
||||
const loginWithSpid = () => {
|
||||
/*if (!loading) {
|
||||
if (!loading && !isMaintenance) {
|
||||
if (APP_HUB_ID) {
|
||||
window.location.replace(`${API_BASE_URL}/saml2/authenticate/loginumbria?hubId=${APP_HUB_ID}`);
|
||||
} else {
|
||||
window.location.replace(`${API_BASE_URL}/saml2/authenticate/loginumbria`);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
const validateCallback = (data) => {
|
||||
@@ -46,6 +47,7 @@ const Login = () => {
|
||||
userData: data.data.user
|
||||
});
|
||||
} else {
|
||||
if (errorMsgs.current) {
|
||||
errorMsgs.current.show([
|
||||
{
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
@@ -54,10 +56,12 @@ const Login = () => {
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
const validateError = (err) => {
|
||||
if (errorMsgs.current) {
|
||||
errorMsgs.current.show([
|
||||
{
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
@@ -65,6 +69,7 @@ const Login = () => {
|
||||
closable: true
|
||||
}
|
||||
]);
|
||||
}
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -77,6 +82,20 @@ const Login = () => {
|
||||
setVisibleCacheFaq(false);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (isMaintenance) {
|
||||
if (errorMsgs.current) {
|
||||
errorMsgs.current.show([
|
||||
{
|
||||
sticky: true, severity: 'info', summary: '',
|
||||
detail: __('Piattaforma in manutenzione', 'gepafin'),
|
||||
closable: false
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
}, [isMaintenance])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isEmpty(token)) {
|
||||
window.location.replace('/')
|
||||
@@ -103,7 +122,7 @@ const Login = () => {
|
||||
|
||||
<Messages ref={errorMsgs}/>
|
||||
|
||||
<button className="appPageLogin__spidBtn" onClick={loginWithSpid} disabled={true}>
|
||||
<button className="appPageLogin__spidBtn" onClick={loginWithSpid} disabled={isMaintenance}>
|
||||
<svg width="31" height="31" viewBox="0 0 31 31" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clipPath="url(#clip0_1156_13356)">
|
||||
<path
|
||||
|
||||
Reference in New Issue
Block a user