Fixed Bug 67513: Client: Added authorized flag for download operation page
This commit is contained in:
parent
dec78c077f
commit
720422c65d
@ -24,7 +24,7 @@
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Loader } from "@docspace/shared/components/loader";
|
||||
import Section from "@docspace/shared/components/section";
|
||||
@ -42,6 +42,8 @@ const Auth = (props) => {
|
||||
let [searchParams, setSearchParams] = useSearchParams();
|
||||
const { t } = useTranslation(["Common"]);
|
||||
|
||||
const [authorized, setAuthorized] = useState(false);
|
||||
|
||||
const referenceUrl = searchParams.get("referenceUrl");
|
||||
const isFileHandler =
|
||||
referenceUrl && referenceUrl.indexOf("filehandler.ashx") !== -1;
|
||||
@ -63,6 +65,7 @@ const Auth = (props) => {
|
||||
try {
|
||||
new URL(referenceUrl);
|
||||
if (isFileHandler && isExternalDownloading) {
|
||||
setAuthorized(true);
|
||||
return;
|
||||
} else {
|
||||
return window.location.replace(referenceUrl);
|
||||
@ -86,6 +89,7 @@ const Auth = (props) => {
|
||||
return isFileHandler && isExternalDownloading ? (
|
||||
<OperationContainer
|
||||
url={referenceUrl}
|
||||
authorized={authorized}
|
||||
title={t("DownloadOperationTitle")}
|
||||
description={t("DownloadOperationDescription")}
|
||||
/>
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
export interface IOperationContainer {
|
||||
url?: string;
|
||||
authorized: boolean;
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ import { Text } from "../text";
|
||||
import PortalLogo from "../portal-logo/PortalLogo";
|
||||
|
||||
const OperationContainer = (props: IOperationContainer) => {
|
||||
const { url, title, description } = props;
|
||||
const { url, authorized, title, description } = props;
|
||||
|
||||
const theme = useTheme();
|
||||
|
||||
@ -46,8 +46,8 @@ const OperationContainer = (props: IOperationContainer) => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (url) window.location.replace(url);
|
||||
}, [url]);
|
||||
if (url && authorized) window.location.replace(url);
|
||||
}, [url, authorized]);
|
||||
|
||||
return (
|
||||
<StyledOperationContainer>
|
||||
|
Loading…
Reference in New Issue
Block a user