mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 10:26:09 +00:00
minor: remove logout handler from singin page (#16237)
This commit is contained in:
parent
7451688a21
commit
ed7f8cd915
@ -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<JwtPayload>(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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user