From ed7f8cd9151d30d29e6d359d7ce2aa6ba4f1f250 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Mon, 13 May 2024 22:32:50 +0530 Subject: [PATCH] minor: remove logout handler from singin page (#16237) --- .../ui/src/pages/LoginPage/SignInPage.tsx | 36 +------------------ 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/LoginPage/SignInPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/LoginPage/SignInPage.tsx index 758c23032e5..86779fca59a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/LoginPage/SignInPage.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/LoginPage/SignInPage.tsx @@ -14,7 +14,6 @@ import Icon from '@ant-design/icons/lib/components/Icon'; import { Button, Col, Divider, Form, Input, Row, Typography } from 'antd'; import classNames from 'classnames'; -import jwtDecode, { JwtPayload } from 'jwt-decode'; import React, { useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useHistory } from 'react-router-dom'; @@ -40,13 +39,7 @@ const SignInPage = () => { const [form] = Form.useForm(); const history = useHistory(); - const { - authConfig, - onLoginHandler, - onLogoutHandler, - isAuthenticated, - getOidcToken, - } = useApplicationStore(); + const { authConfig, onLoginHandler, isAuthenticated } = useApplicationStore(); const { t } = useTranslation(); @@ -61,25 +54,6 @@ const SignInPage = () => { const { handleLogin, loginError } = useBasicAuth(); - const isTokenExpired = () => { - const token = getOidcToken(); - if (token) { - try { - const { exp } = jwtDecode(token); - if (exp) { - if (Date.now() < exp * 1000) { - // Token is valid - return false; - } - } - } catch (error) { - // ignore error - } - } - - return true; - }; - const handleSignIn = () => { onLoginHandler && onLoginHandler(); }; @@ -152,14 +126,6 @@ const SignInPage = () => { ); }; - // If user is neither logged in or nor security is disabled - // invoke logout handler to clean-up any slug storage - useEffect(() => { - if (!isAuthenticated && isTokenExpired()) { - onLogoutHandler(); - } - }, []); - useEffect(() => { // If the user is already logged in or if security is disabled // redirect the user to the home page.