Login: fix access for auth user
This commit is contained in:
parent
76ba5fdf98
commit
d2fe1b8e9b
1
packages/login/index.d.ts
vendored
1
packages/login/index.d.ts
vendored
@ -96,6 +96,7 @@ declare global {
|
||||
capabilities: ICapabilities;
|
||||
match: MatchType;
|
||||
currentColorScheme: ITheme;
|
||||
isAuth: boolean;
|
||||
}
|
||||
|
||||
interface DevRequest {
|
||||
|
@ -24,7 +24,6 @@ import SSOIcon from "../../../../../public/images/sso.react.svg";
|
||||
|
||||
interface ILoginProps extends IInitialState {
|
||||
isDesktopEditor?: boolean;
|
||||
isAuth: boolean;
|
||||
}
|
||||
const Login: React.FC<ILoginProps> = ({
|
||||
portalSettings,
|
||||
@ -33,7 +32,6 @@ const Login: React.FC<ILoginProps> = ({
|
||||
capabilities,
|
||||
isDesktopEditor,
|
||||
match,
|
||||
isAuth,
|
||||
currentColorScheme,
|
||||
theme,
|
||||
}) => {
|
||||
@ -46,10 +44,6 @@ const Login: React.FC<ILoginProps> = ({
|
||||
|
||||
const { t } = useTranslation(["Login", "Common"]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isAuth) window.location.href = "/";
|
||||
}, []);
|
||||
|
||||
const ssoExists = () => {
|
||||
if (ssoUrl) return true;
|
||||
else return false;
|
||||
|
@ -31,7 +31,7 @@ app.use("/login", express.static(path.resolve(path.join(__dirname, "client"))));
|
||||
|
||||
app.use(logger("dev", { stream: stream }));
|
||||
|
||||
app.get("*", async (req: ILoginRequest, res: Response) => {
|
||||
app.get("*", async (req: ILoginRequest, res: Response, next) => {
|
||||
const { i18n, cookies, headers, query, t, url } = req;
|
||||
let initialState: IInitialState;
|
||||
let assets: assetsType;
|
||||
@ -41,6 +41,11 @@ app.get("*", async (req: ILoginRequest, res: Response) => {
|
||||
try {
|
||||
initialState = await getInitialState(query);
|
||||
|
||||
if (initialState.isAuth) {
|
||||
res.redirect('/');
|
||||
next();
|
||||
}
|
||||
|
||||
let currentLanguage = initialState.portalSettings.culture;
|
||||
|
||||
if (cookies && cookies[LANGUAGE]) {
|
||||
|
Loading…
Reference in New Issue
Block a user