added encypted document link
This commit is contained in:
+3
-1
@@ -33,4 +33,6 @@ I18N_DOMAIN = "cymru.local"
|
||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
SHOWLOGIN = "false"
|
||||
SHOWREPRESENTATIONS = "false"
|
||||
BASIC_AUTH_CREDENTIALS,,= pinswg:password|pinswg2:password2
|
||||
BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
||||
|
||||
NEXT_PUBLIC_ISHARESECRETPHRASE = "Secret phrase"
|
||||
@@ -7,6 +7,7 @@ import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import PaginationControl from "./pagination";
|
||||
import LoadingOverlay from "react-loading-overlay";
|
||||
import CryptoJS from "crypto-js";
|
||||
|
||||
import {
|
||||
getBasicSearch,
|
||||
@@ -106,7 +107,9 @@ const DocumentDetails = (props) => {
|
||||
<a
|
||||
href={
|
||||
"/api/proxy/documents/download/" +
|
||||
detailsObj.pinswg_isharedocumentreference
|
||||
encryptDocReference(
|
||||
detailsObj.pinswg_isharedocumentreference
|
||||
)
|
||||
}
|
||||
>
|
||||
<span className="results-visually-hidden">
|
||||
@@ -191,6 +194,17 @@ const DocumentDetails = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const encryptDocReference = (documentRef) => {
|
||||
var encrypted = encodeURIComponent(
|
||||
CryptoJS.AES.encrypt(
|
||||
documentRef,
|
||||
process.env.NEXT_PUBLIC_ISHARESECRETPHRASE
|
||||
)
|
||||
);
|
||||
|
||||
return encrypted;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const docDetailsObj = async () => {
|
||||
let docObj = await getSearchDocumentDetails1(incidentid)
|
||||
|
||||
Reference in New Issue
Block a user