Merged PR 616: hardening changes and UAT tweaks

hardeing changes and UAT tweaks

Related work items: #6740
This commit is contained in:
Robert Bond
2021-11-18 10:09:56 +00:00
23 changed files with 221 additions and 213 deletions
+11 -11
View File
@@ -1,9 +1,9 @@
// dev
//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
//RELAYURI = "dev-pedw-ns.servicebus.windows.net"
//RELAYPATH = "dev-pedw-hc"
//SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="
//SASKEYNAME = "devpedwnspolicy"
RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
RELAYURI = "dev-pedw-ns.servicebus.windows.net"
RELAYPATH = "dev-pedw-hc"
SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="
SASKEYNAME = "devpedwnspolicy"
PORT= "3000"
@@ -23,15 +23,15 @@ I18N_DOMAIN = "cymru.local"
//preprod
RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
RELAYURI = "pp-pedw-ns.servicebus.windows.net"
RELAYPATH = "pp-pedw-hc"
SASKEY = "JzrOYfMTsGBD1cZHH2nkzqsbfDCqg0brO6jyiIDNVPo="
SASKEYNAME = "pppedwnspolicy"
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
//RELAYPATH = "pp-pedw-hc"
//SASKEY = "JzrOYfMTsGBD1cZHH2nkzqsbfDCqg0brO6jyiIDNVPo="
//SASKEYNAME = "pppedwnspolicy"
GOOGLE_TAG_MANAGER = GTM-T78CBC3
SHOWLOGIN = "false"
SHOWLOGIN = "true"
SHOWREPRESENTATIONS = "false"
BASIC_AUTH_CREDENTIALS,, = pinswg:password|pinswg2:password2
+141 -147
View File
@@ -2,10 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import HmacSHA256 from "crypto-js/hmac-sha256";
//import {XMLHttpRequest} from 'xmlhttprequest';
//process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
import { has, indexOf } from "lodash";
let BASE_URL;
const port = parseInt(process.env.PORT, 10) || 3000;
@@ -105,12 +102,17 @@ const azureHeadersPaged = (SASToken) => {
};
};
const hashProxyPath = (queryPath) => {
const hashAPIPath = (queryPath) => {
var hashPath =
queryPath.indexOf("/api/proxy/") == -1
? queryPath
: queryPath.split("/api/proxy/")[1];
var hashlink = CryptoJS.HmacSHA256(
queryPath,
hashPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString();
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return "&hash=" + hashlink;
};
@@ -118,26 +120,22 @@ const hashProxyPath = (queryPath) => {
export const getBasicSearch = (token, searchString) => {
//console.log("\n\n", token, searchString);
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
searchString +
"') or contains(ticketnumber, '" +
searchString +
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
return axios
.get(
WEBAPI_URL +
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
searchString +
"') or contains(ticketnumber, '" +
searchString +
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true",
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => {
// console.log(" ");
// console.log("/////////////////////");
// console.log("data:" + res.data.value);
// console.log("/////////////////////");
// console.log(" ");
return res.data;
})
.catch((error) => {
//console.log("thiserror", error);
return error.response;
});
};
@@ -159,7 +157,7 @@ export const getBasicSearchPaged = (searchString, pageNumber) => {
//console.log(queryUrl);
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
// console.log(" ");
// console.log("/////////////////////");
@@ -175,10 +173,12 @@ export const getBasicSearchPaged = (searchString, pageNumber) => {
};
export const getBasicDNSSearch = (token, searchString) => {
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
return axios
.get(
WEBAPI_URL +
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true",
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -197,7 +197,7 @@ export const getBasicDNSSearchPaged = (pageNumber) => {
: "");
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
return error.response;
@@ -234,12 +234,13 @@ export const getAdvancedSearch = (token, searchString) => {
searchString.apt
: "";
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
queryString +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
return axios
.get(
WEBAPI_URL +
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
queryString +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true",
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -294,7 +295,7 @@ export const getAdvancedSearchPaged = (searchString, pageNumber) => {
: "");
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
let ErrResponse = {
@@ -314,15 +315,17 @@ export const getBasicSearchDetails = (
incidentID
) => {
//console.log("check appealtype:", appealType, caseReference);
var queryUrl =
appealTypeName +
"?$filter=_" +
primaryIdAttribute +
"s_value eq " +
incidentID +
"&$count=true";
return axios
.get(
WEBAPI_URL +
appealTypeName +
"?$filter=_" +
primaryIdAttribute +
"s_value eq " +
incidentID +
"&$count=true",
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -349,7 +352,7 @@ export const getBasicSearchDetailsPaged = (
"&$count=true";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this error", error);
@@ -358,12 +361,13 @@ export const getBasicSearchDetailsPaged = (
export const getSearchDocumentDetails = (token, incidentID) => {
console.log(incidentID);
var queryUrl =
"pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " +
incidentID +
" and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference";
return axios
.get(
WEBAPI_URL +
"pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " +
incidentID +
" and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference",
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -373,11 +377,12 @@ export const getSearchDocumentDetails = (token, incidentID) => {
};
export const getSearchDocumentHistory = (token, documentID) => {
var queryUrl =
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
documentID;
return axios
.get(
WEBAPI_URL +
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
documentID,
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -400,7 +405,7 @@ export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => {
: "");
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -417,7 +422,7 @@ export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
: "");
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -432,7 +437,7 @@ export const getSearchDocumentDetails1 = (incidentID) => {
incidentID +
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -450,7 +455,7 @@ export const getSearchDocumentDetails1Paged = (incidentID, pageNumber) => {
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
: "");
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -464,7 +469,7 @@ export const getSearchDocumentHistory1 = (documentID) => {
"/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
documentID;
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
return res.data;
})
@@ -483,7 +488,7 @@ export const getSearchDocumentHistory1Paged = (documentID, pageNumber) => {
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
: "");
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
return res.data;
})
@@ -493,12 +498,13 @@ export const getSearchDocumentHistory1Paged = (documentID, pageNumber) => {
};
export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
var queryUrl =
"pinswg_dnses?$filter=pinswg_name eq '" +
caseReference +
"'&$count=true";
return axios
.get(
WEBAPI_URL +
"pinswg_dnses?$filter=pinswg_name eq '" +
caseReference +
"'&$count=true",
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -516,7 +522,7 @@ export const getBasicDNSSearchDetailsPaged = (caseReference) => {
"'&$count=true";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -530,7 +536,7 @@ export const getLinkedCases = (parentIncidentid) => {
parentIncidentid +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
//console.log(" linked date", res.data);
return res.data;
@@ -541,16 +547,12 @@ export const getLinkedCases = (parentIncidentid) => {
};
export const getFormData = (token, whichForm) => {
//console.log("got to axios", whichForm);
//console.log("api_root: ", BASE_URL);
var queryUrl =
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" +
whichForm +
"%27and%20type%20eq%202)&$count=true&$top=201";
return axios
.get(
WEBAPI_URL +
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" +
whichForm +
"%27and%20type%20eq%202)&$count=true&$top=201",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -558,14 +560,12 @@ export const getFormData = (token, whichForm) => {
};
export const getMandatoryFields = (token, whichForm) => {
var queryUrl =
"EntityDefinitions(LogicalName='pinswg_" +
whichForm +
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel";
return axios
.get(
WEBAPI_URL +
"EntityDefinitions(LogicalName='pinswg_" +
whichForm +
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -573,14 +573,12 @@ export const getMandatoryFields = (token, whichForm) => {
};
export const getPickLists = (token, whichForm) => {
var queryUrl =
"EntityDefinitions(LogicalName='pinswg_" +
whichForm +
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true";
return axios
.get(
WEBAPI_URL +
"EntityDefinitions(LogicalName='pinswg_" +
whichForm +
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -588,12 +586,10 @@ export const getPickLists = (token, whichForm) => {
};
export const getAppealsTypes = (token) => {
var queryUrl =
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
return axios
.get(
WEBAPI_URL +
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log(error);
@@ -609,12 +605,10 @@ export const getAppealsTypes = (token) => {
export const getLPA = (token) => {
// console.log("api_root: ", BASE_URL);
var queryUrl =
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
return axios
.get(
WEBAPI_URL +
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => {
//console.log(res.data);
return res.data;
@@ -631,15 +625,13 @@ export const getLPA = (token) => {
};
export const getPersonalAccount = (token, contactid) => {
//console.log("getting personal details:", contactid);
var queryUrl =
"contacts(" +
contactid +
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true";
return axios
.get(
WEBAPI_URL +
"contacts(" +
contactid +
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => {
console.log(res.data);
return res.data;
@@ -660,7 +652,7 @@ export const getAppealID = (
updateFormCollection,
primaryAttribute
) => {
const weburl =
const queryUrl =
"/api/proxy/" +
updateFormCollection +
"?$count=true&$select=_" +
@@ -669,9 +661,12 @@ export const getAppealID = (
caseReference +
"'";
console.log("proxy url ", weburl);
console.log("proxy url ", queryUrl);
return axios
.get(weburl, azureHeaders(getSASToken()))
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(getSASToken())
)
.then((res) => {
var appealID = res.data.value[0][primaryAttribute];
return appealID;
@@ -690,7 +685,7 @@ export const getLogin = (emailAddress, pwd) => {
"'&$count=true&$select=emailaddress1,%20contactid,pinswg_custom_password, yomifullname, firstname, lastname";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -699,6 +694,8 @@ export const getLogin = (emailAddress, pwd) => {
export const createCase = (token, appealTypeId, lpaID, contactid) => {
appealTypeId = parseInt(appealTypeId);
var queryUrl = "incidents";
var data = JSON.stringify({
"title": "insertion test case",
"caseorigincode": 3,
@@ -709,7 +706,7 @@ export const createCase = (token, appealTypeId, lpaID, contactid) => {
var config = {
method: "post",
url: WEBAPI_URL + "incidents",
url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -748,10 +745,11 @@ export const updateCase = async (
console.log("appeal obj ", appealObj);
var queryUrl = "/api/proxy/" + updateFormCollection + "(" + appealObj + ")";
var config = {
method: "patch",
//url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
url: "/api/proxy/" + updateFormCollection + "(" + appealObj + ")",
//url: updateFormCollection + "(" + incidentId + ")",
url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -776,14 +774,12 @@ export const updateCase = async (
export const getMyCases = (token, loggedInUserId) => {
//console.log("in action ", loggedInUserId);
var queryUrl =
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
loggedInUserId +
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3";
return axios
.get(
WEBAPI_URL +
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
loggedInUserId +
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => {
return res.data;
})
@@ -793,14 +789,12 @@ export const getMyCases = (token, loggedInUserId) => {
};
export const getMyRepresentations = (token, loggedInUserId) => {
var queryUrl =
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL +
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -813,7 +807,7 @@ export const getMyRepresentationsProxy = (token, loggedInUserId) => {
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -821,9 +815,11 @@ export const getMyRepresentationsProxy = (token, loggedInUserId) => {
};
export const deleteMyRepresentations = (myRepresentationsID) => {
var queryUrl =
"/api/proxy/pinswg_representationses(" + myRepresentationsID + ")";
var config = {
method: "delete",
url: "/api/proxy/pinswg_representationses(" + myRepresentationsID + ")",
url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -850,7 +846,7 @@ export const getRepresentations = (incidentID) => {
incidentID +
" and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -863,7 +859,7 @@ export const getRepresentationsProxy = (token, incidentID) => {
incidentID +
"&$count=true&$orderby=createdon desc";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -871,14 +867,12 @@ export const getRepresentationsProxy = (token, incidentID) => {
};
export const getWatchedCases = (token, loggedInUserId) => {
var queryUrl =
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(
WEBAPI_URL +
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$count=true&$orderby=createdon desc",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -891,7 +885,7 @@ export const getWatchedCasesProxy = (token, loggedInUserId) => {
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
.get(queryUrl | +hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -900,10 +894,11 @@ export const getWatchedCasesProxy = (token, loggedInUserId) => {
export const createWatchedCases = (formValues) => {
var data = JSON.stringify(formValues);
var queryUrl = "/api/proxy/pinswg_watchlists";
var config = {
method: "post",
url: "/api/proxy/pinswg_watchlists",
url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -926,9 +921,10 @@ export const createWatchedCases = (formValues) => {
};
export const deleteWatchedCases = (watchedCaseID) => {
var queryUrl = "/api/proxy/pinswg_watchlists(" + watchedCaseID + ")";
var config = {
method: "delete",
url: "/api/proxy/pinswg_watchlists(" + watchedCaseID + ")",
url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -961,15 +957,13 @@ export const getAwaitingSubmission = (token) => {
};
export const getPortalModuleDetails = (token, appealType, caseReference) => {
var queryUrl =
appealType +
"?$filter=pinswg_name eq '" +
caseReference +
"'&$count=true";
return axios
.get(
WEBAPI_URL +
appealType +
"?$filter=pinswg_name eq '" +
caseReference +
"'&$count=true",
azureHeaders(token)
)
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -988,7 +982,7 @@ export const getPortalModuleDetailsProxy = (
caseReference +
"'&$count=true";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -1002,7 +996,7 @@ export const getEmailAccountCheck = (emailAddress) => {
emailAddress +
"'&$count=true&$select=emailaddress1, contactid";
return axios
.get(queryUrl + hashProxyPath(queryUrl))
.get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -1011,10 +1005,10 @@ export const getEmailAccountCheck = (emailAddress) => {
export const createAccount = (formValues) => {
var data = JSON.stringify(formValues);
var queryUrl = "/api/proxy/contacts";
var config = {
method: "post",
url: "/api/proxy/contacts",
url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -1038,10 +1032,10 @@ export const createAccount = (formValues) => {
export const updateAccount = (contactId, updateBody) => {
var data = JSON.stringify(updateBody);
var queryUrl = "/api/proxy/contacts(" + contactId + ")";
var config = {
method: "patch",
url: "/api/proxy/contacts(" + contactId + ")",
url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -1066,10 +1060,10 @@ export const updateAccount = (contactId, updateBody) => {
export const updatePassword = (contactId, newpassword) => {
let updateBody = { "pinswg_custom_password": newpassword };
var data = JSON.stringify(updateBody);
var queryUrl = "/api/proxy/contacts(" + contactId + ")";
var config = {
method: "patch",
url: "/api/proxy/contacts(" + contactId + ")",
url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
+4 -3
View File
@@ -77,11 +77,12 @@ const RegisterForm = (props) => {
let errorsobj = {};
const emailRegex =
/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi;
const required = (value) => (value ? undefined : "Is required");
const email = (value) =>
value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value)
? "Invalid email address"
: undefined;
value && !emailRegex.test(value) ? "Invalid email address" : undefined;
const phoneNumber = (value) =>
value &&
!/^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$/i.test(
+3 -3
View File
@@ -195,13 +195,13 @@ const DocumentDetails = (props) => {
const encryptDocReference = (documentRef) => {
var hashlink = CryptoJS.HmacSHA256(
"/api/proxy/documents/download/" + documentRef,
"documents/download/" + documentRef,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString();
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (
"/api/proxy/documents/download/" + documentRef + "&hash=" + hashlink
"/api/proxy/documents/download/" + documentRef + "?hash=" + hashlink
);
};
@@ -234,7 +234,6 @@ const Pinswg_callinss77id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
@@ -260,7 +259,6 @@ const Pinswg_callinss77id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
@@ -286,7 +284,6 @@ const Pinswg_callinss77id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
@@ -325,7 +322,6 @@ const Pinswg_callinss77id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
@@ -351,7 +347,7 @@ const Pinswg_callinss77id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +371,7 @@ const Pinswg_callinss77id = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -399,7 +395,6 @@ const Pinswg_callinss77id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-decision-date-label")}
@@ -371,7 +371,7 @@ const Pinswg_commonlandid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_commonlandid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -353,7 +353,7 @@ const Pinswg_compulsorypurchaseordersid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -377,7 +377,7 @@ const Pinswg_compulsorypurchaseordersid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -351,7 +351,7 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -351,7 +351,7 @@ const Pinswg_enforcementnoticeappeals174id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_enforcementnoticeappeals174id = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -371,7 +371,7 @@ const Pinswg_environmentalpermittingid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_environmentalpermittingid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -371,7 +371,7 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -351,7 +351,7 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
+2 -2
View File
@@ -351,7 +351,7 @@ const Pinswg_ldpid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_ldpid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -351,7 +351,7 @@ const Pinswg_listedbuildingandconservationrid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_listedbuildingandconservationrid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -351,7 +351,7 @@ const Pinswg_maintenanceoflands217id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_maintenanceoflands217id = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -371,7 +371,7 @@ const Pinswg_miscellaneouscasewordid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_miscellaneouscasewordid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -351,7 +351,7 @@ const Pinswg_planningappeals78id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_planningappeals78id = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -351,7 +351,7 @@ const Pinswg_planningconditionss73s79id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_planningconditionss73s79id = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -351,7 +351,7 @@ const Pinswg_planningobligationappeals106id = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_planningobligationappeals106id = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
+2 -2
View File
@@ -371,7 +371,7 @@ const Pinswg_rowid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_rowid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
@@ -371,7 +371,7 @@ const Pinswg_wayleaveid = (props) => {
)}
</dd>
</div>
<div className="govuk-summary-list__row">
{/* <div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_wayleaveid = (props) => {
"case:summary-no-date-entered-label"
)}
</dd>
</div>
</div> */}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:summary-event-date-label")}
+1 -1
View File
@@ -30,7 +30,7 @@
"footer-alternative-languages-link-label": "Ieithoedd amgen",
"footer-alternative-languages-link": "https://llyw.cymru/ieithoedd-amgen",
"footer-guidance-link-label": "Canllawiau a gwasanaethau Penderfyniadau Cynllunio ac Amgylchedd Cymru",
"footer-guidance-link": "https://gov.wales/planning-and-environment-decisions-wales/guidance-services",
"footer-guidance-link": "https://llyw.cymru/penderfyndiadau-cynllunio-ac-amgylchedd-cymru/canllawiau-gwasanaethau",
"mobile-nav-label": "Dewislen",
"signout-label": "Allgofnodwch",
"back-to-top-link": "Nôl i dop y dudalen",
+27 -9
View File
@@ -52,13 +52,18 @@ const getSASToken = () => {
function checkProxyPath(queryPath) {
const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY;
var hashPath =
queryPath.indexOf("/api/proxy/") == -1
? queryPath
: queryPath.split("/api/proxy/")[1];
const wordKey = WORDKEY;
var hashlink = CryptoJS.HmacSHA256(
decodeURI(queryPath),
decodeURI(hashPath),
CryptoJS.enc.Hex.parse(wordKey)
);
hashlink = hashlink.toString();
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return hashlink;
}
@@ -66,13 +71,24 @@ function checkProxyPath(queryPath) {
export default async function ApiProxy(req, res) {
var data = JSON.stringify(req.body);
const SASToken = getSASToken();
const isDocument = req.url.indexOf("/documents/download") > -1;
let hashCheckPath = isDocument
? req.url.split("?hash=")[0]
: req.url.split("&hash=")[0];
let hashCheckValue = isDocument
? req.url.split("?hash=")[1]
: req.url.split("&hash=")[1];
let hashFromRequest = checkProxyPath(hashCheckPath);
var configNoData = {
method: req.method,
//url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")",
url:
PROXY_RELAY_URL +
req.url.split("&hash=")[0].split("/api/proxy/")[1],
req.url.split("&hash=")[0].split("/api/proxy/")[1] +
"&hash=" +
req.url.split("&hash=")[1],
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -86,7 +102,11 @@ export default async function ApiProxy(req, res) {
var config = {
method: req.method,
url: PROXY_RELAY_URL + req.query.route[0],
url:
PROXY_RELAY_URL +
req.query.route[0] +
"&hash=" +
req.url.split("&hash=")[1],
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -102,7 +122,9 @@ export default async function ApiProxy(req, res) {
method: req.method,
url:
PROXY_RELAY_URL +
req.url.split("&hash=")[0].split("/api/proxy/")[1],
req.url.split("?hash=")[0].split("/api/proxy/")[1] +
"?hash=" +
req.url.split("?hash=")[1],
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -114,10 +136,6 @@ export default async function ApiProxy(req, res) {
responseType: "arraybuffer",
};
let hashCheckPath = req.url.split("&hash=")[0];
let hashCheckValue = req.url.split("&hash=")[1];
let hashFromRequest = checkProxyPath(hashCheckPath);
if (hashCheckValue == hashFromRequest) {
return new Promise((resolve, reject) => {
let hasDocument =