Author SHA1 Message Date
Robert Bond 9dfa2e8792 Merged PR 2677: Feature/ithc mitigation final
Related work items: #25509, #25515, #25516
2026-11-10 11:04:13 +00:00
Robert Bond 220d7826b2 Merged PR 2675: Feature/ithc mitigation
ITHC fixes

Related work items: #25508, #25509, #25510, #25513, #25514, #25515
2026-11-10 10:39:40 +00:00
robbond 73419aa598 fix(security): prevent caching of sensitive API responses 2026-11-09 16:38:19 +00:00
robbond 63c56da143 fix(security): disable legacy XSS browser filter 2026-11-09 15:56:30 +00:00
robbond ff84e9ea0f fix(security): use server-configured PET notification recipient 2026-11-09 14:04:31 +00:00
robbond f4f8075af3 fix(security): harden Contact Us PET notifications 2026-11-09 13:41:31 +00:00
robbond 3c0a9ef721 fix(security): harden Contact Us sender confirmations 2026-11-09 13:06:22 +00:00
robbond b821dc2092 fix(security): append Contact Us CRM activity reminder 2026-11-09 12:07:08 +00:00
robbond b15ac5e664 fix(security): harden Contact Us CRM task endpoint 2026-11-09 11:17:17 +00:00
robbond fef9591b5d fix(security): protect representation blob deletion against CSRF 2026-11-09 09:31:41 +00:00
robbond 4eba824ac2 fix(security): protect case blob deletion against CSRF 2026-11-09 07:56:59 +00:00
robbond 12b0e5eff0 fix(storage): await recursive blob deletions and propagate failures 2026-11-07 11:17:48 +00:00
robbond 57e0c62940 fix(storage): constrain recursive blob deletion to resource folders 2026-11-07 11:12:08 +00:00
robbond bb8c5047c8 Merge ITHC recovery into mitigation baseline 2026-11-07 07:55:52 +00:00
robbond 1377aebc89 fix: enforce representation blob ownership and secure SSR access 2026-11-06 17:05:40 +00:00
robbond 946d361a67 test: cover ITHC cross-user blob deletion protection 2026-11-06 13:02:49 +00:00
robbond c49b491698 refactor: migrate myportal viewall account lookup to server helper 2026-11-06 11:58:01 +00:00
robbond bf2e4a3254 refactor: migrate myportal index account lookup to server helper 2026-11-06 11:33:49 +00:00
robbond 4b552e9cdd refactor: extract server-side CRM personal account lookup 2026-11-06 11:22:42 +00:00
robbond b9be188d27 security: enforce CRM contact ownership and account field allowlist 2026-11-06 10:55:47 +00:00
robbond 71de8a2d14 refactor: extract server-side CRM contact update 2026-11-06 09:58:02 +00:00
robbond ea5e90943d chore: remove unused legacy CRM password validation 2026-11-06 09:26:10 +00:00
robbond ddcef8f5ea security: remove obsolete CRM login endpoint 2026-11-06 09:22:29 +00:00
robbond f7479b72b9 security: remove obsolete CRM password update functionality 2026-11-06 09:14:54 +00:00
robbond e1f8fb5c96 Revert "security: enforce authenticated CRM contact ownership"
This reverts commit e13700ab65.
2026-11-06 06:42:16 +00:00
robbond e13700ab65 security: enforce authenticated CRM contact ownership 2026-11-06 06:36:53 +00:00
robbond a0a1331a97 fix(security): retire obsolete CRM representation deletion endpoint 2026-11-05 17:18:30 +00:00
robbond faf3aa3675 fix(security): enforce ownership on private draft case creation 2026-11-05 16:58:35 +00:00
robbond 9b0cb9adc8 fix(security): retire legacy direct CRM case creation endpoint 2026-11-05 16:37:10 +00:00
robbond 93bf7e174f fix(security): enforce ownership on private draft PDF generation 2026-11-05 14:11:45 +00:00
robbond 8b045ab781 fix(security): enforce ownership across appeal completion 2026-11-05 13:28:43 +00:00
robbond fc960f907f fix(security): enforce ownership on private draft blob deletion 2026-11-05 13:04:09 +00:00
robbond 056dace563 fix(security): enforce ownership on draft blob listing proxy 2026-11-05 12:59:55 +00:00
robbond 9d6d3b9f71 fix(security): enforce ownership on appeal and representation blob proxies 2026-11-05 12:53:24 +00:00
robbond 0a115a8808 security: preserve representation history in watched-case upsert 2026-11-05 12:48:45 +00:00
robbond 706083b6f0 test: update endpoint contract fixtures and add test filtering 2026-11-05 10:25:59 +00:00
robbond 431c45ba2b security: enforce CRM watched-case deletion ownership 2026-11-05 10:24:52 +00:00
robbond eeb4a1f441 fix: restore watched-case deletion through subscriptions facade 2026-11-05 10:02:30 +00:00
robbond 2badf2e272 security: enforce authenticated CRM contact ownership 2026-11-05 06:49:00 +00:00
robbond 601668a675 security: enforce CRM watched-case deletion ownership 2026-11-04 17:44:05 +00:00
robbond d0ce82c69f security: retire obsolete CRM representation deletion endpoint 2026-11-04 17:10:23 +00:00
robbond 5729625229 fix(security): enforce ownership on private draft case creation 2026-11-04 16:07:23 +00:00
robbond b59959fb83 fix(security): enforce ownership on private draft PDF generation 2026-11-04 15:36:52 +00:00
robbond 4829c49c7b fix(security): enforce ownership across appeal completion 2026-11-04 14:20:11 +00:00
robbond f8245861b7 fix(security): enforce ownership on private draft blob deletion 2026-11-04 14:01:50 +00:00
robbond 9d8678f52a fix(security): enforce ownership on draft blob listing proxy 2026-11-04 13:45:56 +00:00
robbond 7649ad3615 fix(security): enforce ownership on appeal and representation blob proxies 2026-11-04 13:23:51 +00:00
robbond 569faa77e5 fix(security): isolate NextAuth email provider from Nodemailer 2026-11-04 11:26:01 +00:00
robbond d9f0c0797d fix(security): strip video embeds from rich text linkification 2026-11-04 10:51:56 +00:00
robbond 500a30e95b chore: remove obsolete static appeal form definitions 2026-11-04 10:04:28 +00:00
robbond ebe8cab03f fix(deps): migrate ESLint tooling for Next.js 16 2026-11-04 10:01:40 +00:00
robbond 16a206ae0f fix(security): remove obsolete Swagger documentation endpoint 2026-11-04 09:17:23 +00:00
robbond b170f65210 fix(deps): upgrade webpack to 5.112.2 2026-11-04 09:09:17 +00:00
robbond 945f5d4f5d fix(deps): remove unused server-side Application Insights SDK 2026-11-04 08:52:33 +00:00
robbond 07ea9c5451 fix(deps): upgrade Azure Identity and remove vulnerable uuid dependency 2026-11-04 07:50:07 +00:00
robbond ddf5aba9f5 fix(deps): upgrade direct uuid dependency to 11.1.1 2026-11-04 07:47:18 +00:00
robbond 4f1bde2440 fix(deps): upgrade file-type to 22.3.0 2026-11-04 07:45:29 +00:00
robbond 3a75c69b3a fix(deps): remove unused react-quill dependency 2026-11-04 07:36:12 +00:00
robbond 3f91a3e095 fix(security): replace nookies with patched cookie utility 2026-11-04 06:54:36 +00:00
robbond cd0c690454 fix(deps): update react-cookie-consent to address js-cookie vulnerability 2026-11-04 06:25:47 +00:00
robbond e46b00b4aa fix(deps): update immutable to patched release 2026-11-04 06:19:37 +00:00
robbond 814d23d3f5 fix(deps): update ajv to patched release 2026-11-04 06:06:25 +00:00
robbond c6e6f923a8 fix(deps): remove unused moment dependency 2026-11-04 06:04:13 +00:00
robbond ba639da696 fix(deps): update fflate to patched release 2026-11-04 06:01:07 +00:00
robbond e5bb0477f4 fix(deps): update browserslist to patched release 2026-11-03 18:06:30 +00:00
robbond 38ade33bf3 fix(deps): update nevware21 ts-utils to patched release 2026-11-03 18:04:28 +00:00
robbond 14e8ad82d1 fix(deps): remove vulnerable serialize-javascript dependency 2026-11-03 17:57:16 +00:00
robbond 7fc6acea5c fix(deps): update source-map-js to patched release 2026-11-03 17:11:23 +00:00
robbond ba83555771 fix(deps): update picomatch to patched releases 2026-11-03 17:09:07 +00:00
robbond 99073e2146 fix(deps): update brace-expansion to patched releases 2026-11-03 17:07:28 +00:00
robbond 1c2ae06793 fix(deps): update flatted to patched release 2026-11-03 17:05:15 +00:00
robbond 4c227da77a fix(deps): update js-yaml to patched release 2026-11-03 17:03:29 +00:00
robbond ef9a630e5e fix(deps): update jws to patched releases 2026-11-03 16:44:56 +00:00
robbond 7c8b7025a1 fix(deps): update validator to patched release 2026-11-03 16:37:36 +00:00
robbond 40d5629ac3 fix(deps): update lodash and lodash-es to patched releases 2026-11-03 16:36:01 +00:00
robbond 127b7c26d4 fix(deps): update multiparty to patched release 2026-11-03 16:25:58 +00:00
robbond 1d01cc4bdb fix(deps): remove unused legacy jsonpath dependency 2026-11-03 16:22:22 +00:00
robbond be8ee5cfdb fix(deps): remove unused compression dependency 2026-11-03 16:14:05 +00:00
robbond 898e1762bb fix(deps): update xmldom to patched release 2026-11-03 16:09:56 +00:00
robbond 933858ed6c fix(deps): update Azure XML parser dependencies 2026-11-03 16:05:15 +00:00
robbond ea92d85e6a fix(deps): remove unused react-pdf dependency 2026-11-03 15:52:54 +00:00
robbond 37b8dc7916 fix(deps): remove unused Swagger UI dependencies 2026-11-03 15:43:24 +00:00
robbond 298fa25c9b fix(deps): update Express and proxy-addr 2026-11-03 14:32:28 +00:00
robbond 40092a8915 fix(deps): update axios and transitive dependencies 2026-11-03 14:26:46 +00:00
robbond 441c9376f4 fix(deps): remove unused vulnerable Auth.js Prisma adapter 2026-11-03 13:56:56 +00:00
robbond cb24e02ce7 fix(styles): replace deprecated step-related Sass division 2026-11-03 13:27:35 +00:00
robbond adcf017d49 fix(styles): replace deprecated step-nav Sass division 2026-11-03 13:15:47 +00:00
robbond 697b1adc5f chore: revert vscode debug 2026-11-03 12:59:21 +00:00
robbond 41151d987f chore: update vscode debug launch.json 2026-11-03 12:56:51 +00:00
robbond 86a3e28d8e chore(build): reduce dependency Sass deprecation noise 2026-11-03 12:54:24 +00:00
robbond ba9294ad1a chore(deps): upgrade Next.js 16 with Webpack 2026-11-03 11:10:11 +00:00
robbond 16ca736789 chore(deps): update NextAuth v4 compatibility baseline 2026-11-03 10:15:53 +00:00
robbond bb50b17277 fix(ithc): correct server-side session retrieval for file APIs 2026-11-03 09:25:02 +00:00
robbond d417860d1d Merge branch 'SIPS-Development' into feature/ithc-mitigation 2026-11-02 16:05:12 +00:00
Robert Bond cfbd72e313 Merged PR 2666: fix: remove duplicate getDetails import from representation loader
fix: remove duplicate getDetails import from representation loader

Related work items: #25470
2026-11-02 13:08:20 +00:00
Robert Bond 93eabe8e6d Merged PR 2665: 25470 testing authentication handler
Related work items: #25470
2026-11-02 12:41:09 +00:00
Robert Bond ce21a1a00f Merged PR 2664: fixes on advanced search
fixes on advanced search

Related work items: #25462
2026-10-30 11:06:32 +00:00
robbond be2df2da8f Merge remote-tracking branch 'origin/SIPS-Development' into feature/ithc-mitigation 2026-10-27 13:33:15 +00:00
Robert Bond 2b691ac4ef Merged PR 2653: fix: preserve LPA questionnaire PDF metadata during submission
fix: preserve LPA questionnaire PDF metadata during submission

Related work items: #25435
2026-10-27 13:07:41 +00:00
robbond 65616f6307 ITHC: enforce container ownership on uploads 2026-10-27 06:05:47 +00:00
robbond 5e98d6e8c2 ITHC: enforce administrative case deletion authorization 2026-10-27 05:40:50 +00:00
robbond 8b607d8134 ITHC: enforce representation completion ownership and admin access 2026-10-26 17:11:38 +00:00
robbond 034b59a981 ITHC: enforce representation blob proxy ownership and admin access 2026-10-26 16:17:52 +00:00
robbond 37aeb03509 ITHC: protect administrative representation unlock endpoint 2026-10-26 15:27:10 +00:00
robbond 0daeb783b9 Stage 3: enforce blob deletion ownership and add admin representation deletion
Also repairs two stale Phase 21 fixtures:
- Supplies a valid PDF to exercise the upload dependency-failure path.
- Injects getPersonalAccount into the representation-involvement VM fixture.
2026-10-26 14:39:22 +00:00
robbond 848728584e Stage 2: integrate administrative login and protect dashboard 2026-10-26 14:31:07 +00:00
robbond d11c4a868e Add independent administrative authentication foundation 2026-10-26 12:51:42 +00:00
Robert Bond fdeff5b898 Merged PR 2605: updated query to include consultationclosed check
updated query to include consultationclosed check

Related work items: #24836
2026-09-07 10:46:32 +00:00
Robert Bond 4e9d585566 Merged PR 2596: fix build error
fix build error

Related work items: #24648
2026-09-02 12:37:32 +00:00
Robert Bond b95a20a980 Merged PR 2595: updated regex to exclude bulk annon mailers
updated regex to exclude bulk annon mailers

Related work items: #24648
2026-09-02 08:02:38 +00:00
Robert Bond c9e7743782 Merged PR 2586: update text for reps showing
update text for reps showing

Related work items: #24650
2026-08-25 15:20:56 +00:00
Robert Bond 6bf5918387 Merged PR 2585: added text before make reps button
added text before make reps button

Related work items: #24650
2026-08-25 09:01:11 +00:00
Robert Bond c2d79cf83f Merged PR 2580: fixed the links
fixed the links

Related work items: #24648
2026-08-20 12:54:44 +00:00
Robert Bond 6ba1e16f9a Merged PR 2573: added link to footer
added link to footer

Related work items: #24649
2026-08-18 15:17:25 +00:00
Robert Bond 6cce7d05f1 Merged PR 2572: overlay link to guidance
overlay link to guidance

Related work items: #24650
2026-08-18 15:02:36 +00:00
Robert Bond ac4834a2a4 Merged PR 2570: updated copyright links
updated copyright links

Related work items: #24648
2026-08-18 14:21:54 +00:00
Robert Bond 850006d917 Merged PR 2559: added package lock
added package lock

Related work items: #24389
2026-08-12 14:03:23 +00:00
Robert Bond 478fa91004 Merged PR 2558: updated link on awaiting submission view allin welsh
updated link on awaiting submission view allin welsh

Related work items: #24389
2026-08-12 13:58:07 +00:00
Robert Bond 5813d409bc Merged PR 2557: removed field
removed field

Related work items: #24554
2026-08-11 09:26:07 +00:00
Robert Bond 71035a054f Merged PR 2556: updated welsh translation
updated welsh translation

Related work items: #24389
2026-08-11 09:13:22 +00:00
Robert Bond c2c4690b9b Merged PR 2555: missing slash in welsh url for case link
missing slash in welsh url for case link

Related work items: #24389
2026-08-10 13:11:18 +00:00
Robert Bond 9e2461305f Merged PR 2546: upodated copy
upodated copy

Related work items: #24335
2026-08-05 11:40:56 +00:00
Robert Bond db07425788 Merged PR 2541: update description for case closed
update description for case closed

Related work items: #24335
2026-08-05 08:31:17 +00:00
Robert Bond 90e8cacf67 Merged PR 2537: adjusted back button on first page of reopend rep
adjusted back button on first page of reopend rep

Related work items: #24488
2026-08-04 10:42:07 +00:00
Robert Bond 6462bd5163 Merged PR 2536: updated path to wrapper to fix build error
updated path to wrapper to fix build error

Related work items: #24215
2026-08-04 08:30:13 +00:00
Robert Bond d190fa8ff7 Merged PR 2534: adjusted breadcrumb for viewall return from a case
adjusted breadcrumb for viewall return from a case

Related work items: #24389
2026-08-04 08:09:04 +00:00
173 changed files with 17752 additions and 48138 deletions
-34
View File
@@ -1,34 +0,0 @@
{
"extends": "next/core-web-vitals",
"rules": {
"@next/next/no-img-element": "off",
"react/no-unknown-property": "error"
}//,
//...your configuration
// "overrides": [
// //...your overrides
// {
// // Force the setting of a swagger description on each api endpoint
// "files": ["pages/api/**/*.js"],
// "plugins": ["jsdoc"],
// "rules": {
// "jsdoc/no-missing-syntax": [
// "error",
// {
// "contexts": [
// {
// "comment": "JsdocBlock:has(JsdocTag[tag=swagger])",
// "context": "any",
// "message": "@swagger documentation is required on each API. Check this out for syntax info: https://github.com/jellydn/next-swagger-doc"
// }
// ]
// }
// ]
// }
// }
// ]
}
+35 -6
View File
@@ -525,6 +525,31 @@ export const deleteBlob = async (containerName, blobName) => {
return { "deleted": blobName }; return { "deleted": blobName };
}; };
const isSafeDeletionPathSegment = (value) =>
typeof value === "string" &&
value.length > 0 &&
value.length <= 255 &&
value === value.trim() &&
value !== "." &&
value !== ".." &&
!/[\\/\u0000-\u001f\u007f]/.test(value);
const buildDeletionFolderPrefix = (resourcePath, expectedSegmentCount) => {
if (typeof resourcePath !== "string") {
throw new Error("Invalid deletion resource path");
}
const segments = resourcePath.split("/");
if (
segments.length !== expectedSegmentCount ||
!segments.every(isSafeDeletionPathSegment)
) {
throw new Error("Invalid deletion resource path");
}
return segments.join("/") + "/";
};
export const deleteBlobCase = async (containerName, blobName) => { export const deleteBlobCase = async (containerName, blobName) => {
const creds = new DefaultAzureCredential(); const creds = new DefaultAzureCredential();
@@ -538,13 +563,15 @@ export const deleteBlobCase = async (containerName, blobName) => {
//conLog"deleteBlobCase "); //conLog"deleteBlobCase ");
console.log("blob to delete:", blobName); const folderPrefix = buildDeletionFolderPrefix(blobName, 1);
console.log("blob to delete:", folderPrefix);
for await (const blob of containerClient.listBlobsFlat({ for await (const blob of containerClient.listBlobsFlat({
prefix: blobName prefix: folderPrefix
})) { })) {
console.log(" ------ :", blob.name); console.log(" ------ :", blob.name);
containerClient.deleteBlob(blob.name); await containerClient.deleteBlob(blob.name);
} }
//containerClient.deleteBlob(blobName); //containerClient.deleteBlob(blobName);
@@ -566,17 +593,19 @@ export const deleteBlobRep = async (containerName, blobName) => {
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`; const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
const containerClient = new ContainerClient(sasUrl); const containerClient = new ContainerClient(sasUrl);
console.log("blob to delete:", blobName); const folderPrefix = buildDeletionFolderPrefix(blobName, 2);
console.log("blob to delete:", folderPrefix);
for await (const blob of containerClient.listBlobsFlat({ for await (const blob of containerClient.listBlobsFlat({
prefix: blobName prefix: folderPrefix
})) { })) {
console.log("------ :", blob.name); console.log("------ :", blob.name);
const blockBlobClient = containerClient.getBlockBlobClient(blob.name); const blockBlobClient = containerClient.getBlockBlobClient(blob.name);
console.log("=======:", await blockBlobClient.exists()); console.log("=======:", await blockBlobClient.exists());
(await blockBlobClient.exists()) && (await blockBlobClient.exists()) &&
containerClient.deleteBlob(blob.name); (await containerClient.deleteBlob(blob.name));
//containerClient.deleteIfExists(); //containerClient.deleteIfExists();
//containerClient.deleteBlob(blob.name); //containerClient.deleteBlob(blob.name);
+2 -2
View File
@@ -1,8 +1,8 @@
import { getJson, requestJson } from "./endpointClient"; import { getJson, requestJson } from "./endpointClient";
import { getSignedJson, postSignedJson } from "./signedRequestClient"; import { getSignedJson, postSignedJson } from "./signedRequestClient";
export const getFileJson = (url) => { export const getFileJson = (url, config) => {
return getJson(url); return getJson(url, config);
}; };
export const getSignedFileJson = async (queryUrl) => { export const getSignedFileJson = async (queryUrl) => {
-25
View File
@@ -11,31 +11,6 @@ export const getPersonalAccount = (contactid) => {
}); });
}; };
export const getLogin = (emailAddress, pwd) => {
return getJson(
"/api/endpoint/getlogin_api?emailAddress=" +
emailAddress +
"&pwd=" +
pwd
).catch((error) => {
consoleLogger(error);
});
};
export const updatePassword = (contactId, newpassword) => {
var queryUrl = "/api/endpoint/updateaccount_api?contactId=" + contactId;
var data = { "pinswg_custom_password": newpassword };
var config = {
method: "post",
url: queryUrl,
data: data
};
return requestJson(config).catch((error) => {
consoleLogger(error);
});
};
export const updateAccount = async (contactId, updateBody, ssr) => { export const updateAccount = async (contactId, updateBody, ssr) => {
var queryUrl = var queryUrl =
(ssr ? BASE_URL : "") + (ssr ? BASE_URL : "") +
-4
View File
@@ -1,7 +1,5 @@
import { import {
getPersonalAccount, getPersonalAccount,
getLogin,
updatePassword,
updateAccount, updateAccount,
createAccount, createAccount,
getEmailAccountCheck, getEmailAccountCheck,
@@ -12,8 +10,6 @@ import {
export { export {
getPersonalAccount, getPersonalAccount,
getLogin,
updatePassword,
updateAccount, updateAccount,
createAccount, createAccount,
getEmailAccountCheck, getEmailAccountCheck,
-29
View File
@@ -76,35 +76,6 @@ export const getAppealID = (
}); });
}; };
export const createNewCase = (
appealTypeId,
lpaID,
contactid,
createBody,
containerName
) => {
appealTypeId = parseInt(appealTypeId);
var data = createBody;
var queryUrl = buildFileQuery("/api/endpoint/createcase_api", {
appealTypeId,
lpaID,
contactid,
containername: containerName
});
var config = {
method: "post",
url: withBaseUrl(BASE_URL, queryUrl),
data: data
};
return requestJson(config).catch((error) => {
consoleLogger(error);
});
};
export const createNewCaseBlob = ( export const createNewCaseBlob = (
appealTypeId, appealTypeId,
lpaID, lpaID,
-2
View File
@@ -4,7 +4,6 @@ import {
getSIPSEvents, getSIPSEvents,
getSIPSMedia, getSIPSMedia,
getAppealID, getAppealID,
createNewCase,
createNewCaseBlob, createNewCaseBlob,
updateCase, updateCase,
updateCaseBlob, updateCaseBlob,
@@ -26,7 +25,6 @@ export {
getSIPSEvents, getSIPSEvents,
getSIPSMedia, getSIPSMedia,
getAppealID, getAppealID,
createNewCase,
createNewCaseBlob, createNewCaseBlob,
updateCase, updateCase,
updateCaseBlob, updateCaseBlob,
+39 -4
View File
@@ -28,13 +28,48 @@ export const getAwaitingSubmissionFromBlob = (containerName) => {
}); });
}; };
export const getRepsFromBlob = (containerName) => { export const getRepsFromBlob = (containerName, config) => {
const route = buildFileQuery("/api/file/getrepsblob", { const route = buildFileQuery("/api/file/getrepsblob", {
container: containerName container: containerName
}); });
const url = withBaseUrl(BASE_URL, appendHashSuffix(route, hashAPIPath));
const hasForwardedCookie =
typeof config?.headers?.Cookie === "string" &&
config.headers.Cookie.length > 0;
if (hasForwardedCookie) {
let trustedDestination = false;
try {
const destination = new URL(url);
const expectedOrigin = new URL(process.env.NEXTAUTH_URL);
trustedDestination =
destination.origin === expectedOrigin.origin &&
["http:", "https:"].includes(destination.protocol) &&
!destination.username &&
!destination.password;
} catch {
trustedDestination = false;
}
if (!trustedDestination) {
return Promise.reject(
new Error("Untrusted representation request destination")
);
}
}
return getFileJson( return getFileJson(
withBaseUrl(BASE_URL, appendHashSuffix(route, hashAPIPath)) url,
hasForwardedCookie
? {
...config,
maxRedirects: 0
}
: config
).catch((error) => { ).catch((error) => {
consoleLogger(error); consoleLogger(error);
}); });
@@ -83,7 +118,7 @@ export const deleteAwaitingSubmissionsFromBlob = (
casefolderID casefolderID
}); });
return getSignedFileJson(queryUrl).catch((error) => { return postSignedFileJson(queryUrl).catch((error) => {
consoleLogger(error); consoleLogger(error);
}); });
}; };
@@ -99,7 +134,7 @@ export const deleteMyRepresentationsFromBlob = (
repfile repfile
}); });
return getSignedFileJson(queryUrl).catch((error) => { return postSignedFileJson(queryUrl).catch((error) => {
consoleLogger(error); consoleLogger(error);
}); });
}; };
+41
View File
@@ -25,3 +25,44 @@ export const sendEmail = async (
throw error; throw error;
} }
}; };
export const sendContactUsConfirmation = async (formValues, language) => {
const mailData = {
"contactEmail": formValues.contactEmail,
"contactSubject": formValues.contactSubject,
"contactbody": formValues.contactbody,
"typeOfContact": formValues.typeOfContact,
"language": language
};
try {
return await requestJson({
method: "post",
url: "/api/email/contactus-confirmation",
data: mailData
});
} catch (error) {
consoleLogger(error);
throw error;
}
};
export const sendContactUsPETNotification = async (formValues) => {
const mailData = {
"contactEmail": formValues.contactEmail,
"contactSubject": formValues.contactSubject,
"contactbody": formValues.contactbody,
"typeOfContact": formValues.typeOfContact
};
try {
return await requestJson({
method: "post",
url: "/api/email/contactus-pet-notification",
data: mailData
});
} catch (error) {
consoleLogger(error);
throw error;
}
};
-18
View File
@@ -144,24 +144,6 @@ export const createWatchedCases = async (formValues) => {
} }
}; };
export const deleteMyRepresentations = (myRepresentationsID) => {
var queryUrl = buildFileQuery("/api/endpoint/deletemyrepresentations_api", {
myRepresentationsID
});
return deleteSignedJson(queryUrl, {
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json;odata.metadata=none",
"Prefer": 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json"
}
}).catch((error) => {
consoleLogger(error);
});
};
export const deleteAwaitingSubmissions = (incidentID) => { export const deleteAwaitingSubmissions = (incidentID) => {
var queryUrl = buildFileQuery( var queryUrl = buildFileQuery(
"/api/endpoint/deleteawaitingsubmissions_api", "/api/endpoint/deleteawaitingsubmissions_api",
-2
View File
@@ -12,7 +12,6 @@ import {
getAwaitingSubmissionProxy, getAwaitingSubmissionProxy,
createWatchedCases, createWatchedCases,
deleteWatchedCases, deleteWatchedCases,
deleteMyRepresentations,
deleteAwaitingSubmissions, deleteAwaitingSubmissions,
sendCaseCompleteMessage, sendCaseCompleteMessage,
sendCaseCompleteMessageProxy, sendCaseCompleteMessageProxy,
@@ -35,7 +34,6 @@ export {
getAwaitingSubmissionProxy, getAwaitingSubmissionProxy,
createWatchedCases, createWatchedCases,
deleteWatchedCases, deleteWatchedCases,
deleteMyRepresentations,
deleteAwaitingSubmissions, deleteAwaitingSubmissions,
sendCaseCompleteMessage, sendCaseCompleteMessage,
sendCaseCompleteMessageProxy, sendCaseCompleteMessageProxy,
+12 -2
View File
@@ -1,5 +1,5 @@
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import { parseCookies, setCookie } from "nookies"; import { parseCookies, setCookie } from "../lib/cookies";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
const COOKIE_NAME = "pedwAiPolicyNoticeHidden"; const COOKIE_NAME = "pedwAiPolicyNoticeHidden";
@@ -72,7 +72,17 @@ export default function AIPolicyNotice() {
{t("home:ai-policy-notice-paragraph-one")} {t("home:ai-policy-notice-paragraph-one")}
</p> </p>
<p className="govuk-body govuk-!-margin-bottom-4"> <p className="govuk-body govuk-!-margin-bottom-4">
{t("home:ai-policy-notice-paragraph-two")} {t("home:ai-policy-notice-paragraph-two")}{" "}
<a
target="_blank"
rel="noopener noreferrer"
href={t(
"home:ai-policy-notice-paragraph-two-a-link"
)}
>
{t("home:ai-policy-notice-paragraph-two-a-label")}
</a>{" "}
{t("home:ai-policy-notice-paragraph-two-b")}
</p> </p>
<button <button
ref={dismissButtonRef} ref={dismissButtonRef}
-184
View File
@@ -1,184 +0,0 @@
import useTranslation from "next-translate/useTranslation";
import Link from "next/link";
import { useRouter } from "next/router";
import React, { useState } from "react";
import { connect } from "react-redux";
import { Field, formValueSelector, reduxForm } from "redux-form";
import { updatePassword } from "../../actions/services/accountService";
const RenderTextfield = ({
id,
className,
rows,
datafieldname,
name,
label,
input,
type,
errorMsg,
meta: { touched, error },
...custom
}) => {
return (
<>
<div
className={
touched && error
? "govuk-form-group govuk-form-group--error"
: "govuk-form-group "
}
>
<label className="govuk-label " htmlFor={id} id={id + "_label"}>
{label}
</label>
{touched && error && (
<span id={id + "-error"} className="govuk-error-message">
<span className="govuk-visually-hidden">Error:</span>{" "}
{touched &&
((error && (
<span>{errorMsg ? errorMsg : error}</span>
)) ||
(warning && <span>{warning}</span>))}
</span>
)}
<input
{...input}
className={className}
name={name}
id={id}
type={type}
/>
</div>
</>
);
};
const ChangePassword = (props) => {
const {
footerLinks,
pages,
handleSubmit,
value,
setPasswordUpdated,
passwordUpdated
} = props;
let { t, lang } = useTranslation();
const router = useRouter();
const { locale } = router;
let errorsobj = {};
const onHandleSubmit = (values) => {
let contactid = props.props.accountDetails.loggedinUserId;
let updateBody = props.props.form.changepasswordForm.values.newpassword;
console.log(contactid, updateBody);
updatePassword(contactid, updateBody);
setPasswordUpdated(true);
};
const required = (value) => (value ? undefined : "Is required");
const passwordsMustMatch = (value, allValues) =>
value !== allValues.newpassword ? "Passwords do not match" : undefined;
const minLength = (min) => (value) =>
value && value.length < min
? `Must be at least ${min} characters`
: undefined;
const [hasErrors, setHasErrors] = useState("");
return (
<>
{passwordUpdated != true ? (
<form onSubmit={handleSubmit(onHandleSubmit)}>
<fieldset className="govuk-fieldset">
<Field
name="newpassword"
id="newpassword"
component={RenderTextfield}
type="password"
className="govuk-input govuk-input--width-20"
validate={[required, minLength(6)]}
label="New password"
/>
<Field
name="confirmpassword"
id="confirmpassword"
component={RenderTextfield}
type="password"
className="govuk-input govuk-input--width-20"
validate={[required, passwordsMustMatch]}
label="Confirm new password"
/>
</fieldset>
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
Continue
</button>
<Link
href={
"/myportal?q=" +
props.accountDetails.loggedinUserId
}
className="govuk-link"
>
Cancel
</Link>
</div>
</form>
) : (
<>
<p className="govuk-body">
<Link
href={
"/myportal?q=" +
props.accountDetails.loggedinUserId
}
className="govuk-link"
>
Go to My Portal
</Link>
</p>
</>
)}
</>
);
};
const mapStateToProps = (state) => {
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
accountDetails: state.accountDetails
//form: state.form,
};
};
const mapDispatchToProps = (dispatch) => {
return {
setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection));
}
};
};
const selector = formValueSelector("changepasswordForm"); // <-- same as form name
export default connect(
mapStateToProps,
mapDispatchToProps
)(
reduxForm({
form: "changepasswordForm",
destroyOnUnmount: false
})(ChangePassword)
);
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { updateAccount } from "../../actions/services/accountService"; import { updateAccount } from "../../actions/services/accountService";
import { setCookie } from "nookies"; import { setCookie } from "../../lib/cookies";
const PersonalDetailsComplete = (props) => { const PersonalDetailsComplete = (props) => {
const { const {
-5
View File
@@ -92,11 +92,6 @@ const RegisterForm = (props) => {
? "Invalid phone number" ? "Invalid phone number"
: undefined; : undefined;
const passwordsMatch = (value, allValues) =>
value !== allValues.pinswg_custom_password
? "Passwords don't match"
: undefined;
const minLength = (min) => (value) => const minLength = (min) => (value) =>
value && value.length < min value && value.length < min
? `Must be ${min} characters or more` ? `Must be ${min} characters or more`
+113 -28
View File
@@ -2,13 +2,6 @@
import { useState } from "react"; import { useState } from "react";
import Link from "next/link"; import Link from "next/link";
import { bytesToSize } from "../../../components/utils"; import { bytesToSize } from "../../../components/utils";
import {
deleteMyRepresentationsFromBlob,
deleteAwaitingSubmissionsFromBlob,
getRepsFromBlobProxy
} from "../../../actions/services/documentService";
import { sendRepCompleteMessage } from "../../../actions/services/portalService";
import { parseCookies } from "nookies";
import { consoleLogger } from "../../../actions/core/logger"; import { consoleLogger } from "../../../actions/core/logger";
import { formatBlobDates } from "../utils/adminHelper"; import { formatBlobDates } from "../utils/adminHelper";
@@ -25,15 +18,38 @@ export default function StorageTab({ data, repCompleteCount }) {
}; };
const deleteRepItem = (containerID, caseID, repfile) => { const deleteRepItem = (containerID, caseID, repfile) => {
let cookies = parseCookies(); fetch("/api/admin/deleteblobrep", {
//console.log("sssss", containerID, caseID, repfile); method: "POST",
headers: { "Content-Type": "application/json" },
deleteMyRepresentationsFromBlob(containerID, caseID, repfile) body: JSON.stringify({
container: containerID,
casefolderID: caseID,
repfile
})
})
.then((response) => {
if (!response.ok) {
throw new Error("Unable to delete representation");
}
return response.json();
})
.then((data) => { .then((data) => {
return data; return data;
}) })
.then(() => { .then(() => {
getRepsFromBlobProxy(containerID) fetch("/api/admin/getrepsblobproxy", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ container: containerID })
})
.then((response) => {
if (!response.ok) {
throw new Error(
"Unable to refresh representations"
);
}
return response.json();
})
.then((data) => { .then((data) => {
setMyRepresentations(data); setMyRepresentations(data);
setMyRepresentationsDetails(data); setMyRepresentationsDetails(data);
@@ -48,6 +64,9 @@ export default function StorageTab({ data, repCompleteCount }) {
"viewKey": "myRepresentations" "viewKey": "myRepresentations"
}); });
}); });
})
.catch((error) => {
consoleLogger(error);
}); });
}; };
@@ -116,20 +135,52 @@ export default function StorageTab({ data, repCompleteCount }) {
{folder.hasTmpFile && ( {folder.hasTmpFile && (
<> <>
<button <button
onClick={() => { onClick={async () => {
confirm( if (
!confirm(
"Do you want to remove this unsubmitted appeal " + "Do you want to remove this unsubmitted appeal " +
folder.folderPath + folder.folderPath +
"?\n" "?\n"
) && )
(deleteCaseItem( ) {
return;
}
try {
const response =
await fetch(
"/api/admin/deleteblobcase",
{
method: "POST",
headers:
{
"Content-Type":
"application/json"
},
body: JSON.stringify(
{
container:
c.container, c.container,
folder.folderPath, casefolderID:
setData folder.folderPath
), }
)
}
);
if (!response.ok) {
throw new Error(
"Unable to delete case"
);
}
alert( alert(
"Temp case Deleted!" "Temp case Deleted!"
)); );
window.location.reload();
} catch (error) {
consoleLogger(error);
}
}} }}
> >
Delete this TMP appeal Delete this TMP appeal
@@ -174,7 +225,7 @@ export default function StorageTab({ data, repCompleteCount }) {
onClick={async () => { onClick={async () => {
const response = const response =
await fetch( await fetch(
"/api/file/editRepJson", "/api/admin/editRepJson",
{ {
method: "POST", method: "POST",
headers: headers:
@@ -216,7 +267,8 @@ export default function StorageTab({ data, repCompleteCount }) {
{folder.repComplete && ( {folder.repComplete && (
<button <button
onClick={async () => { onClick={async () => {
confirm( if (
!confirm(
"Do you want resend the rep queue message " + "Do you want resend the rep queue message " +
folder.repJsonBlob.name.split( folder.repJsonBlob.name.split(
"/" "/"
@@ -225,20 +277,53 @@ export default function StorageTab({ data, repCompleteCount }) {
folder.repJsonBlob.name.split( folder.repJsonBlob.name.split(
"/" "/"
)[1] )[1]
) && )
(sendRepCompleteMessage( ) {
return;
}
try {
const response =
await fetch(
"/api/admin/createrepcompletemessage",
{
method: "POST",
headers:
{
"Content-Type":
"application/json"
},
body: JSON.stringify(
{
container:
c.container, c.container,
tempcaseref:
folder.repJsonBlob.name.split( folder.repJsonBlob.name.split(
"/" "/"
)[0], )[0],
folder.repJsonBlob.name.split( repid: folder.repJsonBlob.name.split(
"/" "/"
)[1] )[1]
), }
)
}
);
if (!response.ok) {
throw new Error(
"Unable to recreate representation queue message"
);
}
alert( alert(
"rep queue message sent!" "rep queue message sent!"
), );
window.location.reload()); window.location.reload();
} catch (error) {
consoleLogger(
error
);
}
}} }}
> >
Recreate Queue Message Recreate Queue Message
+1 -1
View File
@@ -91,7 +91,7 @@ const Breadcrumbs = (props) => {
watchedCases: () => t("myportal:watchedcases-card-title"), watchedCases: () => t("myportal:watchedcases-card-title"),
myCases: () => t("myportal:mycases-card-title"), myCases: () => t("myportal:mycases-card-title"),
myRepresentations: () => t("myportal:myrepresentations-card-title"), myRepresentations: () => t("myportal:myrepresentations-card-title"),
mySubmittedReps: "Submitted representations" mySubmittedReps: () => t("myportal:submitted-reps-card-title")
}; };
const viewAllLabelResolver = labelsByKey[viewKey]; const viewAllLabelResolver = labelsByKey[viewKey];
+5 -3
View File
@@ -297,7 +297,7 @@ let MakeRepresentation = (props) => {
}); });
let resultsObj = findResultsObjForCurrentReference({ let resultsObj = findResultsObjForCurrentReference({
"currentReference": currentView.caseReference.currentReference, "currentReference": currentView.caseReference.ticketnumber,
"caseResultsSource": caseResultsSource "caseResultsSource": caseResultsSource
}); });
@@ -1006,8 +1006,10 @@ let MakeRepresentation = (props) => {
appealIsConsultation={appealIsConsultation} appealIsConsultation={appealIsConsultation}
currentReference={ticketnumber} currentReference={ticketnumber}
caseTitle={ caseTitle={
currentView.currentReference || currentView?.caseReference?.repDetails
currentView.caseReference.currentReference ?.pinswg_name ||
currentView?.currentReference ||
currentView?.caseReference.currentReference
} }
whichControl={whichControl} whichControl={whichControl}
appealIsLocalImpact={appealIsLocalImpact} appealIsLocalImpact={appealIsLocalImpact}
@@ -33,6 +33,14 @@ export const buildSubmitEnrichedValues = ({
representationCapacity, representationCapacity,
locale locale
}) => { }) => {
const isPopulatedText = (value) =>
value !== null &&
value !== undefined &&
(typeof value !== "string" || value.trim() !== "");
const preserveExistingWhenMissing = (canonicalValue, existingValue) =>
isPopulatedText(canonicalValue) ? canonicalValue : existingValue;
const buildSiteAddress = () => { const buildSiteAddress = () => {
const { const {
pinswg_siteaddressline1, pinswg_siteaddressline1,
@@ -47,10 +55,12 @@ export const buildSubmitEnrichedValues = ({
pinswg_siteaddresstown, pinswg_siteaddresstown,
pinswg_siteaddresspostcode pinswg_siteaddresspostcode
] ]
.filter(Boolean) .filter(isPopulatedText)
.join(" "); .join(" ");
}; };
const siteAddress = buildSiteAddress();
return { return {
...formValues, ...formValues,
containerID: accountDetails.containerID, containerID: accountDetails.containerID,
@@ -58,7 +68,10 @@ export const buildSubmitEnrichedValues = ({
incidentID: incidentID:
caseReferenceObj.incidentid || caseReferenceObj.incidentid ||
caseReferenceObj.repDetails.incidentid, caseReferenceObj.repDetails.incidentid,
caseRef: caseReferenceObj.ticketnumber, caseRef: preserveExistingWhenMissing(
caseReferenceObj.ticketnumber,
formValues.caseRef
),
casereference: caseReferenceObj.currentReference, casereference: caseReferenceObj.currentReference,
pinswg_questionnaireduedate: detailsObj.pinswg_questionnaireduedate, pinswg_questionnaireduedate: detailsObj.pinswg_questionnaireduedate,
pinswg_endofrepresentationperiod: pinswg_endofrepresentationperiod:
@@ -72,12 +85,18 @@ export const buildSubmitEnrichedValues = ({
firstname: accountDetails.firstname, firstname: accountDetails.firstname,
lastname: accountDetails.lastname, lastname: accountDetails.lastname,
emailAddress: accountDetails.emailaddress1, emailAddress: accountDetails.emailaddress1,
siteAddress: buildSiteAddress(), siteAddress: preserveExistingWhenMissing(
siteAddress,
formValues.siteAddress
),
pinswg_siteaddressline1: detailsObj.pinswg_siteaddressline1, pinswg_siteaddressline1: detailsObj.pinswg_siteaddressline1,
pinswg_siteaddressline2: detailsObj.pinswg_siteaddressline2, pinswg_siteaddressline2: detailsObj.pinswg_siteaddressline2,
pinswg_siteaddresstown: detailsObj.pinswg_siteaddresstown, pinswg_siteaddresstown: detailsObj.pinswg_siteaddresstown,
pinswg_siteaddresspostcode: detailsObj.pinswg_siteaddresspostcode, pinswg_siteaddresspostcode: detailsObj.pinswg_siteaddresspostcode,
pinswg_lpareference: resultsObj?.pinswg_lpareference, pinswg_lpareference: preserveExistingWhenMissing(
resultsObj?.pinswg_lpareference,
formValues.pinswg_lpareference
),
_pinswg_appellant_value: detailsObj._pinswg_appellant_value, _pinswg_appellant_value: detailsObj._pinswg_appellant_value,
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue": "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
detailsObj[ detailsObj[
+48 -1
View File
@@ -32,7 +32,7 @@ import {
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { signIn, useSession } from "next-auth/react"; import { signIn, useSession } from "next-auth/react";
import { destroyCookie, parseCookies, setCookie } from "nookies"; import { destroyCookie, parseCookies, setCookie } from "../../lib/cookies";
import { getFormCollectionByID, getDetailsProxy, hasOwn } from "../utils"; import { getFormCollectionByID, getDetailsProxy, hasOwn } from "../utils";
import { import {
getLivePublishedEvent, getLivePublishedEvent,
@@ -877,6 +877,52 @@ const CaseSummary = (props) => {
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<div className="govuk-grid-column-full"> <div className="govuk-grid-column-full">
<div className=""> <div className="">
{getFormCollectionByID(
appealTypeID
).PrimaryIdAttribute ==
"pinswg_sipscase" &&
isConsultationWindowOpen(
detailsObj
) && (
<p>
{t(
"case:summary-make-consultation-response-para-a"
)}
<Link
target="_blank"
className="govuk-link"
href={t(
"case:summary-make-representation-para-a-link"
)}
>
{t(
"case:summary-make-representation-para-a-label"
)}
</Link>
</p>
)}
{isGeneralRepresentationWindowOpen(
detailsObj
) && (
<div className="govuk-button-group">
<p>
{t(
"case:summary-make-representation-para-a"
)}
<Link
target="_blank"
className="govuk-link"
href={t(
"case:summary-make-representation-para-a-link"
)}
>
{t(
"case:summary-make-representation-para-a-label"
)}
</Link>
</p>
</div>
)}
<div className="govuk-button-group"> <div className="govuk-button-group">
{getFormCollectionByID( {getFormCollectionByID(
appealTypeID appealTypeID
@@ -983,6 +1029,7 @@ const CaseSummary = (props) => {
)} )}
</> </>
)} )}
{isGeneralRepresentationWindowOpen( {isGeneralRepresentationWindowOpen(
detailsObj detailsObj
) && ( ) && (
@@ -2,6 +2,7 @@ import _ from "lodash";
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import transLookup from "../../../data/lookuptranslations.json"; import transLookup from "../../../data/lookuptranslations.json";
import resolveCrmDisplayValue from "../../../lib/i18n/crmDisplay/resolveCrmDisplayValue";
import SummaryCard from "../summary/components/SummaryCard"; import SummaryCard from "../summary/components/SummaryCard";
import SummaryRow from "../summary/components/SummaryRow"; import SummaryRow from "../summary/components/SummaryRow";
import { hasOwn } from "../../utils"; import { hasOwn } from "../../utils";
@@ -570,7 +570,7 @@ const Pinswg_sipscase = (props) => {
)} )}
</h4> </h4>
<dl className="govuk-summary-list govuk-!-font-size-16 govuk-!-margin-bottom-9"> <dl className="govuk-summary-list govuk-!-font-size-16 govuk-!-margin-bottom-9">
<SummaryRow {/* <SummaryRow
label={t( label={t(
"case:summary-valid-notice-of-intention-to-submit-an-application" "case:summary-valid-notice-of-intention-to-submit-an-application"
)} )}
@@ -592,7 +592,7 @@ const Pinswg_sipscase = (props) => {
"case:summary-awaiting-information-label" "case:summary-awaiting-information-label"
) )
} }
/> /> */}
<SummaryRow <SummaryRow
label={t( label={t(
"case:summary-written-acceptance-of-notice" "case:summary-written-acceptance-of-notice"
@@ -5,6 +5,7 @@ import { useRouter } from "next/router";
import transLookup from "../../../data/lookuptranslations.json"; import transLookup from "../../../data/lookuptranslations.json";
import SummaryCard from "../summary/components/SummaryCard"; import SummaryCard from "../summary/components/SummaryCard";
import SummaryRow from "../summary/components/SummaryRow"; import SummaryRow from "../summary/components/SummaryRow";
import resolveCrmDisplayValue from "../../../lib/i18n/crmDisplay/resolveCrmDisplayValue";
import { hasOwn } from "../../utils"; import { hasOwn } from "../../utils";
const Pinswg_transportandworkactid = (props) => { const Pinswg_transportandworkactid = (props) => {
+1 -1
View File
@@ -2,7 +2,7 @@ import { signOut } from "next-auth/react";
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { destroyCookie, parseCookies, setCookie } from "nookies"; import { destroyCookie, parseCookies, setCookie } from "../../lib/cookies";
import { signIn, useSession } from "next-auth/react"; import { signIn, useSession } from "next-auth/react";
const WatchModal = (props) => { const WatchModal = (props) => {
+1 -1
View File
@@ -1,7 +1,7 @@
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { parseCookies } from "nookies"; import { parseCookies } from "../../lib/cookies";
import { useState } from "react"; import { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { reduxForm } from "redux-form"; import { reduxForm } from "redux-form";
+27 -14
View File
@@ -108,7 +108,7 @@ export default function Footer(props) {
> >
<span className="vo_hidden"> <span className="vo_hidden">
{t( {t(
"common:social-bar-share-via-link", "common:social-bar-share-via-link"
)}{" "} )}{" "}
</span> </span>
Twitter Twitter
@@ -186,37 +186,37 @@ export default function Footer(props) {
<li className="govuk-footer__inline-list-item govuk-!-font-weight-bold govuk-!-margin-right-7"> <li className="govuk-footer__inline-list-item govuk-!-font-weight-bold govuk-!-margin-right-7">
<a <a
href={t( href={t(
"common:footer-guidance-link", "common:footer-guidance-link"
)} )}
className="nav-link" className="nav-link"
> >
{t( {t(
"common:footer-guidance-link-label", "common:footer-guidance-link-label"
)} )}
</a> </a>
</li> </li>
<li className="govuk-footer__inline-list-item govuk-!-font-weight-bold govuk-!-margin-right-7"> <li className="govuk-footer__inline-list-item govuk-!-font-weight-bold govuk-!-margin-right-7">
<a <a
href={t( href={t(
"common:footer-announcements-link", "common:footer-announcements-link"
)} )}
className="nav-link" className="nav-link"
> >
{t( {t(
"common:footer-announcements-link-label", "common:footer-announcements-link-label"
)} )}
</a> </a>
</li> </li>
<li className="govuk-footer__inline-list-item govuk-!-font-weight-bold"> <li className="govuk-footer__inline-list-item govuk-!-font-weight-bold">
<a <a
href={t( href={t(
"common:footer-contact-us-link", "common:footer-contact-us-link"
)} )}
className="govuk-footer__link" className="govuk-footer__link"
id="aContactUs" id="aContactUs"
> >
{t( {t(
"common:footer-contact-us-link-label", "common:footer-contact-us-link-label"
)} )}
</a> </a>
</li> </li>
@@ -236,7 +236,7 @@ export default function Footer(props) {
id="aAccessibility" id="aAccessibility"
> >
{t( {t(
"common:footer-accessibility-link-label", "common:footer-accessibility-link-label"
)} )}
</Link> </Link>
</li> </li>
@@ -257,13 +257,13 @@ export default function Footer(props) {
<li className="govuk-footer__inline-list-item"> <li className="govuk-footer__inline-list-item">
<a <a
href={t( href={t(
"common:footer-copyright-link", "common:footer-copyright-link"
)} )}
className="govuk-footer__link" className="govuk-footer__link"
id="Access" id="Access"
> >
{t( {t(
"common:footer-copyright-link-label", "common:footer-copyright-link-label"
)} )}
</a> </a>
</li> </li>
@@ -271,13 +271,13 @@ export default function Footer(props) {
<li className="govuk-footer__inline-list-item"> <li className="govuk-footer__inline-list-item">
<Link <Link
href={t( href={t(
"common:footer-privacy-link", "common:footer-privacy-link"
)} )}
id="aPrivacy" id="aPrivacy"
className="govuk-footer__link" className="govuk-footer__link"
> >
{t( {t(
"common:footer-privacy-link-label", "common:footer-privacy-link-label"
)} )}
</Link> </Link>
</li> </li>
@@ -285,13 +285,26 @@ export default function Footer(props) {
<li className="govuk-footer__inline-list-item"> <li className="govuk-footer__inline-list-item">
<Link <Link
href={t( href={t(
"common:footer-terms-conditions-link", "common:footer-terms-conditions-link"
)} )}
id="aTermsConds" id="aTermsConds"
className="govuk-footer__link" className="govuk-footer__link"
> >
{t( {t(
"common:footer-terms-conditions-link-label", "common:footer-terms-conditions-link-label"
)}
</Link>
</li>
<li className="govuk-footer__inline-list-item">
<Link
href={t(
"common:footer-pedw-use-ai-link"
)}
id="aHowToAI"
className="govuk-footer__link"
>
{t(
"common:footer-pedw-use-ai-label"
)} )}
</Link> </Link>
</li> </li>
+1 -1
View File
@@ -2,7 +2,7 @@ import _ from "lodash";
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { destroyCookie, setCookie } from "nookies"; import { destroyCookie, setCookie } from "../lib/cookies";
import { connect } from "react-redux"; import { connect } from "react-redux";
import Banner from "../components/banner"; import Banner from "../components/banner";
import { setLogout } from "../store/accountDetails/action"; import { setLogout } from "../store/accountDetails/action";
+1 -1
View File
@@ -2,7 +2,7 @@ import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { parseCookies } from "nookies"; import { parseCookies } from "../../lib/cookies";
import { setLoggedInUserId } from "../../store/accountDetails/action"; import { setLoggedInUserId } from "../../store/accountDetails/action";
import { signOut, useSession } from "next-auth/react"; import { signOut, useSession } from "next-auth/react";
import CaseComment from "./casecomment"; import CaseComment from "./casecomment";
@@ -1,7 +1,7 @@
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { parseCookies } from "nookies"; import { parseCookies } from "../../lib/cookies";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { import {
deleteAwaitingSubmissionsFromBlob, deleteAwaitingSubmissionsFromBlob,
@@ -70,7 +70,7 @@ const AwaitingSubmissionFromBlob = (props) => {
const deleteCaseItem = (containerID, caseID) => { const deleteCaseItem = (containerID, caseID) => {
let cookies = parseCookies(); let cookies = parseCookies();
console.log("sssss", containerID, caseID); //console.log("sssss", containerID, caseID);
deleteAwaitingSubmissionsFromBlob(containerID, caseID) deleteAwaitingSubmissionsFromBlob(containerID, caseID)
.then((data) => { .then((data) => {
+1 -1
View File
@@ -2,7 +2,7 @@ import _ from "lodash";
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { parseCookies } from "nookies"; import { parseCookies } from "../../lib/cookies";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { import {
deleteAwaitingSubmissions, deleteAwaitingSubmissions,
+1 -1
View File
@@ -1,7 +1,7 @@
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { parseCookies } from "nookies"; import { parseCookies } from "../../lib/cookies";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { import {
deleteAwaitingSubmissions, deleteAwaitingSubmissions,
+3 -7
View File
@@ -3,7 +3,7 @@ import _ from "lodash";
import useTranslation from "next-translate/useTranslation"; import useTranslation from "next-translate/useTranslation";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { parseCookies } from "nookies"; import { parseCookies } from "../../lib/cookies";
import { useState } from "react"; import { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { import {
@@ -212,12 +212,8 @@ const ViewAllResults = (props) => {
} }
if (isAwaitingSubmissionDetails) { if (isAwaitingSubmissionDetails) {
if (router.locale === "cy") {
return "/fymhorth/parhauigyflwyno";
}
return ( return (
"/myportal" + (router.locale === "cy" ? "/fymhorth" : "/myportal") +
"/" + "/" +
getFormCollectionByID(item.pinswg_appealcasetype).UrlName + getFormCollectionByID(item.pinswg_appealcasetype).UrlName +
"?lpa=" + "?lpa=" +
@@ -235,7 +231,7 @@ const ViewAllResults = (props) => {
if (router.locale === "cy") { if (router.locale === "cy") {
return myportal === true return myportal === true
? "/fymhorth/achos" + ? "/fymhorth/achos/" +
item.ticketnumber + item.ticketnumber +
"?key=" + "?key=" +
currentViewKey + currentViewKey +
-18
View File
@@ -27,24 +27,6 @@ export default function YourAccount() {
</Link> </Link>
</div> </div>
</div> </div>
{/* <div className="card-body">
<h3 className="heading-small card-heading">
{t("myportal:changepassword-card-title")}
</h3>
<p className="govuk-body-s">
{" "}
{t("myportal:changepassword-card-paragraph-one")}
</p>
<div>
<Link href="/account/changepassword">
<a className="govuk-button-secondary">
{t("myportal:changepassword-card-link")}
</a>
</Link>
</div>
</div> */}
</div> </div>
</> </>
); );
-7
View File
@@ -393,13 +393,6 @@ let CreateCase = (props) => {
delete values.confirmHASCAS; delete values.confirmHASCAS;
// createNewCase(
// appTypeCollection.appealTypeID,
// values.lpaTypes,
// props.loggedInUser,
// values,
// props.containerID
// )
const selectedLpaName = props.LPAData.LPAData.value.filter((obj) => { const selectedLpaName = props.LPAData.LPAData.value.filter((obj) => {
return obj.accountid === values.lpaTypes; return obj.accountid === values.lpaTypes;
})[0].name; })[0].name;
+1 -1
View File
@@ -8,7 +8,7 @@ import { connect } from "react-redux";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { setCurrentReference } from "../../store/currentView/action"; import { setCurrentReference } from "../../store/currentView/action";
import { parseCookies, setCookie } from "nookies"; import { parseCookies, setCookie } from "../../lib/cookies";
import { useEffect } from "react"; import { useEffect } from "react";
import { setLoggedInUserId } from "../../store/accountDetails/action"; import { setLoggedInUserId } from "../../store/accountDetails/action";
import { import {
+1 -1
View File
@@ -15,7 +15,7 @@ import {
} from "../../actions/services/searchService"; } from "../../actions/services/searchService";
import GoogleMapReact from "google-map-react"; import GoogleMapReact from "google-map-react";
import { parseCookies } from "nookies"; import { parseCookies } from "../../lib/cookies";
import OSPoint from "ospoint"; import OSPoint from "ospoint";
import { import {
createWatchedCases, createWatchedCases,
+1 -2
View File
@@ -14,7 +14,7 @@ import {
setCurrentReference setCurrentReference
} from "../../store/currentView/action"; } from "../../store/currentView/action";
import { parseCookies, setCookie } from "nookies"; import { parseCookies, setCookie } from "../../lib/cookies";
import { useEffect } from "react"; import { useEffect } from "react";
import { setLoggedInUserId } from "../../store/accountDetails/action"; import { setLoggedInUserId } from "../../store/accountDetails/action";
import { import {
@@ -40,7 +40,6 @@ import resolveCrmDisplayValue from "../../lib/i18n/crmDisplay/resolveCrmDisplayV
import { sendGAEvent } from "@next/third-parties/google"; import { sendGAEvent } from "@next/third-parties/google";
import RepsOnResults from "./repsonresults"; import RepsOnResults from "./repsonresults";
import LiveLink from "./liveLink"; import LiveLink from "./liveLink";
import { query } from "jsonpath";
import { splitWatchedCasesBySubmissionState } from "../../lib/domain/dashboard-policy/splitWatchedCasesBySubmissionState"; import { splitWatchedCasesBySubmissionState } from "../../lib/domain/dashboard-policy/splitWatchedCasesBySubmissionState";
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+5 -1
View File
@@ -687,6 +687,8 @@ export const updateLinks = (input) => {
const EMPTY_QUILL_PARAGRAPHS_REGEX = const EMPTY_QUILL_PARAGRAPHS_REGEX =
/<p[^>]*>\s*(?:<br\s*\/?>|&nbsp;|\s)*\s*<\/p>/gi; /<p[^>]*>\s*(?:<br\s*\/?>|&nbsp;|\s)*\s*<\/p>/gi;
const VIDEO_EMBED_REGEX = /<(iframe|video)\b[^>]*>[\s\S]*?<\/\1\s*>/gi;
const URL_REGEX = /\b(https?:\/\/[^\s<]+)/gi; const URL_REGEX = /\b(https?:\/\/[^\s<]+)/gi;
const stripTrailingUrlPunctuation = (url) => { const stripTrailingUrlPunctuation = (url) => {
@@ -732,7 +734,9 @@ export const updateLinks = (input) => {
const processHtmlString = (htmlString) => { const processHtmlString = (htmlString) => {
if (typeof htmlString !== "string" || !htmlString) return htmlString; if (typeof htmlString !== "string" || !htmlString) return htmlString;
let html = htmlString.replace(EMPTY_QUILL_PARAGRAPHS_REGEX, ""); let html = htmlString
.replace(VIDEO_EMBED_REGEX, "")
.replace(EMPTY_QUILL_PARAGRAPHS_REGEX, "");
const anchorPlaceholders = []; const anchorPlaceholders = [];
html = html.replace(/<a\b[^>]*>[\s\S]*?<\/a>/gi, (match) => { html = html.replace(/<a\b[^>]*>[\s\S]*?<\/a>/gi, (match) => {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-7
View File
@@ -1,7 +0,0 @@
const DNSForm = (props) => {
const { caseReference } = props;
return <></>;
};
export default DNSForm;
-353
View File
@@ -1,353 +0,0 @@
const ElectricityActForm = (props) => {
const { caseReference } = props;
return (
<>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-m govuk-!-margin-top-5">
Enter your appeal information
</h1>
<form>
<div class="govuk-grid-column-full">
<div class="govuk-grid-row">
<div class="govuk-form-group">
<label
class="govuk-label "
for="pinswg_name"
>
Name
</label>
<input
type="text"
name="pinswg_name"
id="pinswg_name"
component="[object Object]"
class="govuk-input govuk-input--width-20"
disabled
value="CAS-00497-K4H2Z5"
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_anticipatedgridreferencenorthingtext"
id="pinswg_anticipatedgridreferencenorthingtext_label"
>
Anticipated grid reference northing
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_anticipatedgridreferencenorthingtext"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_anticipatedgridreferenceeastingtext"
id="pinswg_anticipatedgridreferenceeastingtext_label"
>
Anticipated grid reference easting
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_anticipatedgridreferenceeastingtext"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectname"
id="pinswg_projectname_label"
>
Project name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectdiscription"
id="pinswg_projectdiscription_label"
>
Project description
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectdiscription"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectlocation"
id="pinswg_projectlocation_label"
>
Project location
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectlocation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addresscounty"
id="pinswg_addresscounty_label"
>
Address county
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addresscounty"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addressline1"
id="pinswg_addressline1_label"
>
Address line 1
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addressline1"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addressline2"
id="pinswg_addressline2_label"
>
Address line 2
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addressline2"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addresstown"
id="pinswg_addresstown_label"
>
Address Town
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addresstown"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_postcode"
id="pinswg_postcode_label"
>
Post Code
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_postcode"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_agentcontactname"
id="pinswg_agentcontactname_label"
>
Agent contact name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_agentcontactname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_emailaddress"
id="pinswg_emailaddress_label"
>
Email Address
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_emailaddress"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_salutation"
id="pinswg_salutation_label"
>
Salutation
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_salutation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_firstname"
id="pinswg_firstname_label"
>
First Name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_firstname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_lastname"
id="pinswg_lastname_label"
>
Last Name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_lastname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_organisation"
id="pinswg_organisation_label"
>
Organisation
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_organisation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_role"
id="pinswg_role_label"
>
Role
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_role"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_telephonenumber"
id="pinswg_telephonenumber_label"
>
Telephone Number
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_telephonenumber"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_webaddress"
id="pinswg_webaddress_label"
>
Web Address
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_webaddress"
value=""
/>
</div>
</div>
</div>
<div class="govuk-button-group">
<button
type="submit"
class="govuk-button"
data-module="govuk-button"
>
Submit
</button>
</div>
</form>
</div>
</div>
</>
);
};
export default ElectricityActForm;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-353
View File
@@ -1,353 +0,0 @@
const HarbourRevisionOrderForm = (props) => {
const { caseReference } = props;
return (
<>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-m govuk-!-margin-top-5">
Enter your appeal information
</h1>
<form>
<div class="govuk-grid-column-full">
<div class="govuk-grid-row">
<div class="govuk-form-group">
<label
class="govuk-label "
for="pinswg_name"
>
Name
</label>
<input
type="text"
name="pinswg_name"
id="pinswg_name"
component="[object Object]"
class="govuk-input govuk-input--width-20"
disabled
value="CAS-00499-C4D7R4"
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_anticipatedgridreferenceeastingtext"
id="pinswg_anticipatedgridreferenceeastingtext_label"
>
Anticipated grid reference easting
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_anticipatedgridreferenceeastingtext"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_anticipatedgridreferencenorthingtext"
id="pinswg_anticipatedgridreferencenorthingtext_label"
>
Anticipated grid reference northing
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_anticipatedgridreferencenorthingtext"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectname"
id="pinswg_projectname_label"
>
Project name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectdiscription"
id="pinswg_projectdiscription_label"
>
Project description
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectdiscription"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectlocation"
id="pinswg_projectlocation_label"
>
Project location
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectlocation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addresscounty"
id="pinswg_addresscounty_label"
>
Address county
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addresscounty"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addressline1"
id="pinswg_addressline1_label"
>
Address line 1
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addressline1"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addressline2"
id="pinswg_addressline2_label"
>
Address line 2
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addressline2"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addresstown"
id="pinswg_addresstown_label"
>
Address Town
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addresstown"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_agentcontactname"
id="pinswg_agentcontactname_label"
>
Agent contact name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_agentcontactname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_emailaddress"
id="pinswg_emailaddress_label"
>
Email Address
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_emailaddress"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_salutation"
id="pinswg_salutation_label"
>
Salutation
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_salutation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_firstname"
id="pinswg_firstname_label"
>
First Name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_firstname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_lastname"
id="pinswg_lastname_label"
>
Last Name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_lastname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_organisation"
id="pinswg_organisation_label"
>
Organisation
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_organisation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_postcode"
id="pinswg_postcode_label"
>
Post Code
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_postcode"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_role"
id="pinswg_role_label"
>
Role
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_role"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_telephonenumber"
id="pinswg_telephonenumber_label"
>
Telephone Number
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_telephonenumber"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_webaddress"
id="pinswg_webaddress_label"
>
Web Address
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_webaddress"
value=""
/>
</div>
</div>
</div>
<div class="govuk-button-group">
<button
type="submit"
class="govuk-button"
data-module="govuk-button"
>
Submit
</button>
</div>
</form>
</div>
</div>
</>
);
};
export default HarbourRevisionOrderForm;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-49
View File
@@ -1,49 +0,0 @@
const LdpForm = (props) => {
const { caseReference } = props;
return (
<>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-m govuk-!-margin-top-5">
Enter your appeal information
</h1>
<form>
<div class="govuk-grid-column-full">
<div class="govuk-grid-row">
<div class="govuk-form-group">
<label
class="govuk-label "
for="pinswg_name"
>
Name
</label>
<input
type="text"
name="pinswg_name"
id="pinswg_name"
component="[object Object]"
class="govuk-input govuk-input--width-20"
disabled
value="CAS-00508-J6L1F0"
/>
</div>
</div>
</div>
<div class="govuk-button-group">
<button
type="submit"
class="govuk-button"
data-module="govuk-button"
>
Submit
</button>
</div>
</form>
</div>
</div>
</>
);
};
export default LdpForm;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-1918
View File
File diff suppressed because it is too large Load Diff
-353
View File
@@ -1,353 +0,0 @@
const TransportAndWorkActForm = (props) => {
const { caseReference } = props;
return (
<>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-m govuk-!-margin-top-5">
Enter your appeal information
</h1>
<form>
<div class="govuk-grid-column-full">
<div class="govuk-grid-row">
<div class="govuk-form-group">
<label
class="govuk-label "
for="pinswg_name"
>
Name
</label>
<input
type="text"
name="pinswg_name"
id="pinswg_name"
component="[object Object]"
class="govuk-input govuk-input--width-20"
disabled
value="CAS-00498-H2F6B6"
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_anticipatedgridreferenceeastingtext"
id="pinswg_anticipatedgridreferenceeastingtext_label"
>
Anticipated grid reference easting
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_anticipatedgridreferenceeastingtext"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_anticipatedgridreferencenorthingtext"
id="pinswg_anticipatedgridreferencenorthingtext_label"
>
Anticipated grid reference northing
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_anticipatedgridreferencenorthingtext"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectname"
id="pinswg_projectname_label"
>
Project name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectlocation"
id="pinswg_projectlocation_label"
>
Project location
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectlocation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_projectdescription"
id="pinswg_projectdescription_label"
>
Project Description
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_projectdescription"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addresscounty"
id="pinswg_addresscounty_label"
>
Address county
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addresscounty"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addressline1"
id="pinswg_addressline1_label"
>
Address line 1
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addressline1"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addressline2"
id="pinswg_addressline2_label"
>
Address line 2
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addressline2"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_addresstown"
id="pinswg_addresstown_label"
>
Address Town
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_addresstown"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_agentcontactname"
id="pinswg_agentcontactname_label"
>
Agent contact name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_agentcontactname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_emailaddress"
id="pinswg_emailaddress_label"
>
Email Address
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_emailaddress"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_salutation"
id="pinswg_salutation_label"
>
Salutation
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_salutation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_firstname"
id="pinswg_firstname_label"
>
First Name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_firstname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_lastname"
id="pinswg_lastname_label"
>
Last Name
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_lastname"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_organisation"
id="pinswg_organisation_label"
>
Organisation
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_organisation"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_postcode"
id="pinswg_postcode_label"
>
Post Code
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_postcode"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_role"
id="pinswg_role_label"
>
Role
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_role"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_telephonenumber"
id="pinswg_telephonenumber_label"
>
Telephone Number
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_telephonenumber"
value=""
/>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-form-group ">
<label
class="govuk-label "
for="pinswg_webaddress"
id="pinswg_webaddress_label"
>
Web Address
</label>
<input
class="govuk-input govuk-input--width-20"
id="pinswg_webaddress"
value=""
/>
</div>
</div>
</div>
<div class="govuk-button-group">
<button
type="submit"
class="govuk-button"
data-module="govuk-button"
>
Submit
</button>
</div>
</form>
</div>
</div>
</>
);
};
export default TransportAndWorkActForm;
File diff suppressed because it is too large Load Diff
+143
View File
@@ -0,0 +1,143 @@
# Administrative authentication foundation
## Integrated administrative sign-in
Administrators sign in at `/admin/login` using the shared credential configured
as `ADMIN_AUTH_SECRET`. The page submits the credential directly to
`POST /api/admin/auth/login`; it does not place the credential in a URL or store
it in browser storage.
Successful authentication creates the administrative session cookie and sends
the browser to `/admin`. The `/admin` server-side loader validates that cookie
before loading administrative data. A valid session is not sufficient by
itself: the existing `/admin` IP allowlist remains an additional restriction,
and a valid administrator outside the allowed network is sent to `/403`.
The administrative interface provides a **Sign out** control which calls
`POST /api/admin/auth/logout`, clears the cookie, and returns the browser to
`/admin/login`. Sessions expire after 20 minutes and expired, invalid, or
missing sessions are redirected to the login page.
## Required server-side configuration
The deployment must provide all of the following server-side values:
- `ADMIN_AUTH_SECRET`: a unique high-entropy administrative passphrase of at
least 32 characters.
- `ADMIN_SESSION_SECRET`: a different unique high-entropy signing key of at
least 32 characters.
- `NEXTAUTH_URL`: the existing canonical application URL. Administrative login
and logout compare the request `Origin` with this server-configured origin.
The administrative values must never use a `NEXT_PUBLIC_` prefix or be exposed
to browser JavaScript. Do not commit real values. Missing, short, or identical
administrative secrets fail closed.
## Security properties and limitations
- Credentials are derived with Node `scrypt` and compared with
`timingSafeEqual`.
- Sessions are stateless, versioned HMAC-SHA256 tokens with a 20-minute fixed
lifetime and a random nonce.
- The cookie is `HttpOnly`, `SameSite=Strict`, scoped to `/`, explicitly
expires, and is `Secure` in production.
- Login and logout require an exact same-origin `Origin` match against
`NEXTAUTH_URL`; missing or malformed origins fail closed.
- Authentication responses use `Cache-Control: no-store`.
- Logout clears the browser cookie. Because sessions are stateless, a stolen
token can remain valid until its short expiry; later protected routes must
continue verifying signature and expiry on every request.
- This is shared-credential authentication. A valid token proves knowledge of
the shared credential, not the identity of a named administrator.
- Protecting `/admin` prevents its server-side Prisma, storage, and CRM data
loading from running without a valid administrative session. It does not by
itself protect browser-addressable API routes.
## Administrative API protection limitations
The current administrative UI directly uses API routes that do not yet enforce
the administrative session, including:
- `/api/admin/getnewappeals_api`
- `/api/admin/getlatestdocuments_api`
- `/api/admin/getStatusCountsByAppeal_api`
- `/api/admin/getStatusCountsByAppealAndLPA_api`
The appeals and documents routes expose paging operations used after the page
has loaded. The status routes expose administrative dashboard reads. These
routes retain their existing relay token and HMAC behaviour but have no
independent administrative-session authorization. A later authorised stage
must enforce the administrative session on privileged API routes and account
for both browser calls and the existing server-side bootstrap callers.
Storage download and queue actions retain their existing authorization
behaviour. The other administrative API and storage limitations described in
this section remain open.
Directly observed storage routes include:
- `/api/file/getrepsblobproxy`, which forwards a caller-supplied container using
server relay credentials and path signing.
- `/api/file/downloadblob` and `/api/file/createrepcompletemessage_api`, which
enforce existing path-HMAC checks but not administrative authorization.
## Stage 3 deletion controls
Ordinary case and representation deletion through `/api/file/deleteblobcase`
and `/api/file/deleteblobrep` now requires a valid NextAuth session whose user
ID matches the requested Azure container. The existing signed-query/HMAC check
also remains required. Requests that fail ownership or HMAC validation are
rejected before the Azure storage deletion operation is called.
Ordinary JSON and multipart uploads through `/api/file/upload` and
`/api/file/uploadsinglefile` independently require a valid NextAuth session whose
user ID exactly matches the submitted `containerID`. The existing upload HMAC
remains mandatory. Missing or unusable sessions, cross-container requests, and
invalid HMACs are rejected before file processing or Azure storage writes.
Administrative cross-container representation deletion uses the dedicated
`POST /api/admin/deleteblobrep` route. That endpoint independently validates
the administrative session and requires a trusted same-origin request. It also
validates the requested container, case-folder segment, and representation-file
segment before performing deletion.
Administrative cross-container case deletion uses the dedicated
`POST /api/admin/deleteblobcase` route. That endpoint independently validates
the administrative session, requires a trusted same-origin request, and
validates the requested container and case-folder segment before performing
deletion. It invokes the same existing `deleteBlobCase(container,
casefolderID)` operation as the ordinary endpoint. That operation lists and
deletes blobs in the selected container whose names begin with the supplied
case-folder prefix; it does not delete the Azure container or broaden deletion
to unrelated containers.
Administrative representation JSON unlocking uses the dedicated
`POST /api/admin/editRepJson` route. That endpoint independently validates the
administrative session, requires a trusted same-origin request, and validates
the requested container and blob path before removing `repComplete`. The former
`/api/file/editRepJson` route is retired and no longer performs storage access.
Automated contract verification for the implemented deletion controls has
passed, including ordinary ownership/HMAC rejection, administrative method,
session, origin and input rejection, zero deletion calls on rejected requests,
and exact cross-container helper arguments on success. Live Azure behaviour,
browser-level behaviour, and deployment configuration have not been verified
by that automated coverage. The other administrative API and storage
limitations documented above remain open, and these changes do not establish
closure of the overall ITHC finding.
## Deployment requirements before production use
The repository does not provide a demonstrated distributed rate-limit service.
Administrative login must therefore be protected by an ingress, gateway, WAF,
or shared backing service that enforces rate limits consistently across all
deployed instances. A process-local limiter is intentionally not used because
it would reset on restart and could be bypassed across instances.
The deployment must also ensure `NEXTAUTH_URL` is the correct canonical HTTPS
origin. Login and logout intentionally do not derive trust from `Host` or
forwarding headers.
Any future administrative state-changing API must require more than possession
of the cookie: it must independently validate the administrative session and
enforce same-origin/CSRF protection before performing side effects.
+25
View File
@@ -0,0 +1,25 @@
import { defineConfig } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import reactPlugin from "eslint-plugin-react";
export default defineConfig([
...nextVitals,
{
plugins: {
react: reactPlugin
},
rules: {
"@next/next/no-img-element": "off",
"react/no-unknown-property": "error"
}
},
{
files: ["pages/api/file/**/*.js"],
rules: {
"react-hooks/rules-of-hooks": "off"
}
},
{
ignores: [".next/**", "out/**", "build/**", "next-env.d.ts"]
}
]);
+3 -3
View File
@@ -88,9 +88,9 @@ module.exports = {
"/details-about-cookies": ["common", "cookies"], "/details-about-cookies": ["common", "cookies"],
"/terms-and-conditions": ["common"], "/terms-and-conditions": ["common"],
"/account/passwordreset": ["common", "home"], "/account/passwordreset": ["common", "home"],
"/auth/signin": ["common", "common", "auth"], "/auth/signin": ["common", "account", "auth"],
"/auth/verify-request": ["common", "common", "auth"], "/auth/verify-request": ["common", "account", "auth"],
"/auth/error": ["common", "common", "auth"], "/auth/error": ["common", "account", "auth"],
"/admin": ["case"] "/admin": ["case"]
} }
}; };
+228
View File
@@ -0,0 +1,228 @@
import {
createHash,
createHmac,
randomBytes,
scryptSync,
timingSafeEqual
} from "crypto";
export const ADMIN_SESSION_COOKIE = "pedw_admin_session";
export const ADMIN_SESSION_TTL_SECONDS = 20 * 60;
export const ADMIN_PASSPHRASE_MAX_LENGTH = 512;
const TOKEN_VERSION = "v1";
const AUTH_DERIVATION_SALT = "pedw-admin-auth-v1";
const MINIMUM_SECRET_LENGTH = 32;
const CLOCK_SKEW_SECONDS = 60;
const isValidSecret = (value) =>
typeof value === "string" && value.length >= MINIMUM_SECRET_LENGTH;
const getAdminConfiguration = (env = process.env) => {
const authSecret = env.ADMIN_AUTH_SECRET;
const sessionSecret = env.ADMIN_SESSION_SECRET;
if (!isValidSecret(authSecret) || !isValidSecret(sessionSecret)) {
return null;
}
const authDigest = createHash("sha256").update(authSecret).digest();
const sessionDigest = createHash("sha256").update(sessionSecret).digest();
if (timingSafeEqual(authDigest, sessionDigest)) {
return null;
}
return { authSecret, sessionSecret };
};
const deriveCredential = (value) =>
scryptSync(value, AUTH_DERIVATION_SALT, 32, {
N: 16384,
r: 8,
p: 1,
maxmem: 32 * 1024 * 1024
});
const encode = (value) => Buffer.from(value).toString("base64url");
const decode = (value) => Buffer.from(value, "base64url");
export const validateAdminPassphrase = (
passphrase,
{ env = process.env } = {}
) => {
const configuration = getAdminConfiguration(env);
if (
!configuration ||
typeof passphrase !== "string" ||
passphrase.length === 0 ||
passphrase.length > ADMIN_PASSPHRASE_MAX_LENGTH
) {
return false;
}
const expected = deriveCredential(configuration.authSecret);
const supplied = deriveCredential(passphrase);
return timingSafeEqual(expected, supplied);
};
export const issueAdminSession = (
{ env = process.env, now = Date.now, nonce = () => randomBytes(16) } = {}
) => {
const configuration = getAdminConfiguration(env);
if (!configuration) return null;
const issuedAt = Math.floor(now() / 1000);
const payload = {
v: 1,
iat: issuedAt,
exp: issuedAt + ADMIN_SESSION_TTL_SECONDS,
nonce: nonce().toString("base64url")
};
const encodedPayload = encode(JSON.stringify(payload));
const signature = createHmac("sha256", configuration.sessionSecret)
.update(`${TOKEN_VERSION}.${encodedPayload}`)
.digest("base64url");
return `${TOKEN_VERSION}.${encodedPayload}.${signature}`;
};
export const validateAdminSession = (
token,
{ env = process.env, now = Date.now } = {}
) => {
const configuration = getAdminConfiguration(env);
if (!configuration || typeof token !== "string" || token.length > 2048) {
return false;
}
const parts = token.split(".");
if (parts.length !== 3 || parts[0] !== TOKEN_VERSION) return false;
const [version, encodedPayload, suppliedSignature] = parts;
const base64UrlPattern = /^[A-Za-z0-9_-]+$/;
if (
!base64UrlPattern.test(encodedPayload) ||
!base64UrlPattern.test(suppliedSignature)
) {
return false;
}
const expectedSignature = createHmac("sha256", configuration.sessionSecret)
.update(`${version}.${encodedPayload}`)
.digest();
let suppliedSignatureBuffer;
try {
suppliedSignatureBuffer = decode(suppliedSignature);
} catch (_error) {
return false;
}
if (
suppliedSignatureBuffer.length !== expectedSignature.length ||
!timingSafeEqual(expectedSignature, suppliedSignatureBuffer)
) {
return false;
}
let payload;
try {
payload = JSON.parse(decode(encodedPayload).toString("utf8"));
} catch (_error) {
return false;
}
const currentTime = Math.floor(now() / 1000);
return (
payload?.v === 1 &&
Number.isInteger(payload.iat) &&
Number.isInteger(payload.exp) &&
typeof payload.nonce === "string" &&
payload.nonce.length > 0 &&
payload.exp - payload.iat === ADMIN_SESSION_TTL_SECONDS &&
payload.iat <= currentTime + CLOCK_SKEW_SECONDS &&
payload.exp > currentTime
);
};
const cookieSecurityAttributes = (production) => [
"Path=/",
"HttpOnly",
"SameSite=Strict",
...(production ? ["Secure"] : [])
];
export const createAdminSessionCookie = (
token,
{ now = Date.now, production = process.env.NODE_ENV === "production" } = {}
) => {
const expires = new Date(now() + ADMIN_SESSION_TTL_SECONDS * 1000);
return [
`${ADMIN_SESSION_COOKIE}=${encodeURIComponent(token)}`,
`Max-Age=${ADMIN_SESSION_TTL_SECONDS}`,
`Expires=${expires.toUTCString()}`,
...cookieSecurityAttributes(production)
].join("; ");
};
export const createClearedAdminSessionCookie = (
{ production = process.env.NODE_ENV === "production" } = {}
) =>
[
`${ADMIN_SESSION_COOKIE}=`,
"Max-Age=0",
"Expires=Thu, 01 Jan 1970 00:00:00 GMT",
...cookieSecurityAttributes(production)
].join("; ");
export const readAdminSessionCookie = (req) => {
const rawCookie = req?.headers?.cookie;
if (typeof rawCookie !== "string") return null;
for (const entry of rawCookie.split(";")) {
const separator = entry.indexOf("=");
if (separator === -1) continue;
const name = entry.slice(0, separator).trim();
if (name !== ADMIN_SESSION_COOKIE) continue;
try {
return decodeURIComponent(entry.slice(separator + 1).trim());
} catch (_error) {
return null;
}
}
return null;
};
export const hasTrustedSameOrigin = (req, { env = process.env } = {}) => {
const requestOrigin = req?.headers?.origin;
const configuredUrl = env.NEXTAUTH_URL;
if (
typeof requestOrigin !== "string" ||
typeof configuredUrl !== "string" ||
configuredUrl.length === 0
) {
return false;
}
try {
return new URL(requestOrigin).origin === new URL(configuredUrl).origin;
} catch (_error) {
return false;
}
};
export const setAdminAuthNoStore = (res) => {
res.setHeader("Cache-Control", "no-store, max-age=0");
res.setHeader("Pragma", "no-cache");
};
+31
View File
@@ -0,0 +1,31 @@
/**
* NextAuth email provider configuration for PEDW.
*
* PEDW supplies its own sendVerificationRequest implementation using
* GOV.UK Notify, so the default Nodemailer SMTP sender is unnecessary.
*
* Preserve the NextAuth v4 email provider configuration contract.
*/
const EmailProvider = (options = {}) => ({
id: "email",
type: "email",
name: "Email",
server: {
host: "localhost",
port: 25,
auth: {
user: "",
pass: ""
}
},
from: "NextAuth <no-reply@example.com>",
maxAge: 24 * 60 * 60,
async sendVerificationRequest() {
throw new Error(
"PEDW requires a custom GOV.UK Notify verification sender"
);
},
options
});
export default EmailProvider;
+1 -1
View File
@@ -1,4 +1,4 @@
import { destroyCookie } from "nookies"; import { destroyCookie } from "../cookies";
import { signOut } from "next-auth/react"; import { signOut } from "next-auth/react";
const AUTH_COOKIE_CANDIDATES = [ const AUTH_COOKIE_CANDIDATES = [
+120
View File
@@ -0,0 +1,120 @@
import * as cookie from "cookie";
import setCookieParser from "set-cookie-parser";
const isBrowser = () => typeof window !== "undefined";
const createCookie = (name, value, options) => {
let sameSite = options.sameSite;
if (sameSite === true) {
sameSite = "strict";
}
if (sameSite === undefined || sameSite === false) {
sameSite = "lax";
}
const cookieToSet = { ...options, sameSite };
delete cookieToSet.encode;
return { name, value, ...cookieToSet };
};
const hasSameProperties = (firstCookie, secondCookie) => {
const firstProperties = Object.getOwnPropertyNames(firstCookie);
const secondProperties = Object.getOwnPropertyNames(secondCookie);
if (firstProperties.length !== secondProperties.length) {
return false;
}
return firstProperties.every(
(propertyName) =>
firstCookie[propertyName] === secondCookie[propertyName]
);
};
const areCookiesEqual = (firstCookie, secondCookie) => {
let sameSiteMatches = firstCookie.sameSite === secondCookie.sameSite;
if (
typeof firstCookie.sameSite === "string" &&
typeof secondCookie.sameSite === "string"
) {
sameSiteMatches =
firstCookie.sameSite.toLowerCase() ===
secondCookie.sameSite.toLowerCase();
}
return (
hasSameProperties(
{ ...firstCookie, sameSite: undefined },
{ ...secondCookie, sameSite: undefined }
) && sameSiteMatches
);
};
export const parseCookies = (ctx, options) => {
if (ctx?.req?.headers?.cookie) {
return cookie.parse(ctx.req.headers.cookie, options);
}
if (isBrowser()) {
return cookie.parse(document.cookie, options);
}
return {};
};
export const setCookie = (ctx, name, value, options = {}) => {
if (ctx?.res?.getHeader && ctx.res.setHeader) {
if (ctx?.res?.finished) {
console.warn(`Not setting "${name}" cookie. Response has finished.`);
console.warn("You should set cookie before res.send()");
return {};
}
let cookies = ctx.res.getHeader("Set-Cookie") || [];
if (typeof cookies === "string") {
cookies = [cookies];
}
if (typeof cookies === "number") {
cookies = [];
}
const parsedCookies = setCookieParser.parse(cookies, {
decodeValues: false
});
const newCookie = createCookie(name, value, options);
const cookiesToSet = [];
parsedCookies.forEach((parsedCookie) => {
if (!areCookiesEqual(parsedCookie, newCookie)) {
cookiesToSet.push(
cookie.serialize(parsedCookie.name, parsedCookie.value, {
encode: (cookieValue) => cookieValue,
...parsedCookie
})
);
}
});
cookiesToSet.push(cookie.serialize(name, value, options));
ctx.res.setHeader("Set-Cookie", cookiesToSet);
}
if (isBrowser()) {
if (options?.httpOnly) {
throw new Error("Can not set a httpOnly cookie in the browser.");
}
document.cookie = cookie.serialize(name, value, options);
}
return {};
};
export const destroyCookie = (ctx, name, options) =>
setCookie(ctx, name, "", { ...(options || {}), maxAge: -1 });
+3 -1
View File
@@ -120,7 +120,9 @@ export const loadRepresentationBootstrap = async ({ ctx }) => {
const [accountDetails, myRepresentations] = await Promise.all([ const [accountDetails, myRepresentations] = await Promise.all([
getPersonalAccount(loggedInUser), getPersonalAccount(loggedInUser),
getRepsFromBlob(thisSession.user.id) getRepsFromBlob(thisSession.user.id, {
headers: { Cookie: ctx.req?.headers?.cookie || "" }
})
]); ]);
const myRepresentationsDetails = await getDetails( const myRepresentationsDetails = await getDetails(
+10 -13
View File
@@ -219,10 +219,10 @@ export const createRepresentationRouteRenderers = ({
currentView.representationSubmitConfirmation !== true && currentView.representationSubmitConfirmation !== true &&
renderBackCrumb(onRepresentationSubmitBackFromConfirmation)} renderBackCrumb(onRepresentationSubmitBackFromConfirmation)}
{currentView.representationSubmit !== true && {/* {currentView.representationSubmit !== true &&
hasRepDetails && hasRepDetails &&
repDetails?.representationType !== "Questionnaire" && repDetails?.representationType !== "Questionnaire" &&
renderBackCrumb(onRepresentationSubmitBackToDetails)} renderBackCrumb(onRepresentationSubmitBackToDetails)} */}
{currentView.representationSubmit !== true && {currentView.representationSubmit !== true &&
hasRepDetails && hasRepDetails &&
@@ -318,7 +318,10 @@ export const createCaseDetailRouteRenderers = ({
if (va === "true") { if (va === "true") {
return ( return (
<> <>
{renderLinkCrumb("/myportal/viewall", getViewAllLabel(key))} {renderLinkCrumb(
`/myportal/viewall?key=${key}`,
getViewAllLabel(key)
)}
{renderCaseReferenceCrumb(fallbackSearchTitle)} {renderCaseReferenceCrumb(fallbackSearchTitle)}
</> </>
); );
@@ -377,7 +380,10 @@ export const createCaseDetailRouteRenderers = ({
return ( return (
<> <>
{renderMyPortalCrumb()} {renderMyPortalCrumb()}
{renderLinkCrumb("/myportal/viewall", getViewAllLabel(key))} {renderLinkCrumb(
`/myportal/viewall?key=${key}`,
getViewAllLabel(key)
)}
{renderCaseReferenceCrumb(caseReferenceDisplay)} {renderCaseReferenceCrumb(caseReferenceDisplay)}
</> </>
); );
@@ -466,15 +472,6 @@ export const createDetailAndAccountRouteRenderers = ({
{t("account:account-title")} {t("account:account-title")}
</li> </li>
</> </>
),
"/account/changepassword": () => (
<>
{renderLinkCrumb(cyMyPortalHref, t("common:breadcrumb-my-portal"))}
<li className="govuk-breadcrumbs__list-item">
Update your password
</li>
</>
) )
}); });
+81
View File
@@ -0,0 +1,81 @@
const LINK_REMOVED = "[web link removed]";
const OBFUSCATING_SPACE = "[\\s\\u0000-\\u001f\\u007f\\u200b-\\u200d\\ufeff]*";
const SCHEME = `h${OBFUSCATING_SPACE}t${OBFUSCATING_SPACE}t${OBFUSCATING_SPACE}p(?:${OBFUSCATING_SPACE}s)?${OBFUSCATING_SPACE}:${OBFUSCATING_SPACE}\\/${OBFUSCATING_SPACE}\\/`;
const DOMAIN = "(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}";
const URL_TAIL = "[^\\s<>\\\"']*";
const explicitUrlPattern = () => new RegExp(`${SCHEME}${DOMAIN}${URL_TAIL}`, "gi");
const wwwUrlPattern = () => new RegExp(`\\bwww\\.${DOMAIN}${URL_TAIL}`, "gi");
const bareDomainWithPathPattern = () =>
new RegExp(`(^|[^a-z0-9@._-])(${DOMAIN}\\/[^\\s<>\\\"']*)`, "gi");
const stripTrailingPunctuation = (value) => {
let destination = value;
let punctuation = "";
while (/[.,!;:]$/.test(destination)) {
punctuation = destination.slice(-1) + punctuation;
destination = destination.slice(0, -1);
}
while (/[)\]}]$/.test(destination)) {
punctuation = destination.slice(-1) + punctuation;
destination = destination.slice(0, -1);
}
return { destination, punctuation };
};
const replaceUrlMatch = (value) => {
const { destination, punctuation } = stripTrailingPunctuation(value);
return destination ? LINK_REMOVED + punctuation : value;
};
const containsWebDestination = (value) => {
explicitUrlPattern().lastIndex = 0;
wwwUrlPattern().lastIndex = 0;
bareDomainWithPathPattern().lastIndex = 0;
return (
explicitUrlPattern().test(value) ||
wwwUrlPattern().test(value) ||
bareDomainWithPathPattern().test(value)
);
};
export default function removeContactUsEmailLinks(message) {
if (typeof message !== "string") {
return message;
}
let transformed = message;
transformed = transformed.replace(
/<a\b[^>]*>([\s\S]*?)<\/a\s*>/gi,
(match, linkText) =>
containsWebDestination(match)
? `${linkText}${linkText ? " " : ""}${LINK_REMOVED}`
: match
);
transformed = transformed.replace(/<[^>]+>/gi, (tag) =>
containsWebDestination(tag) ? LINK_REMOVED : tag
);
transformed = transformed.replace(
/\[([^\]]*)\]\(([^)]*)\)/gi,
(match, linkText, destination) =>
containsWebDestination(destination)
? `${linkText}${linkText ? " " : ""}${LINK_REMOVED}`
: match
);
transformed = transformed.replace(explicitUrlPattern(), replaceUrlMatch);
transformed = transformed.replace(wwwUrlPattern(), replaceUrlMatch);
transformed = transformed.replace(
bareDomainWithPathPattern(),
(match, prefix, destination) => prefix + replaceUrlMatch(destination)
);
return transformed;
}
+16
View File
@@ -0,0 +1,16 @@
import { relayGetData } from "../../pages/api/middleware/relayForwarding";
import { RELAY_POLICY_LOOKUP } from "../../pages/api/middleware/relayPolicyPresets";
export const getCrmPersonalAccount = async (contactId) => {
const queryUrl =
"contacts(" +
contactId +
")?$select=firstname, lastname, emailaddress1, telephone1, pinswg_companyname, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode,pinswg_typeofinvolvement,pinswg_contact_associatedlpa,pinswg_preferredlanguage&$count=true";
const { data } = await relayGetData({
queryUrl,
relayPolicy: RELAY_POLICY_LOOKUP
});
return data;
};
+29
View File
@@ -0,0 +1,29 @@
import axios from "axios";
import { getToken } from "../../actions/core/token";
import { hashAPIPath } from "../../actions/core/hash";
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
export const updateCrmContact = async (contactId, updatePayload) => {
const token = await getToken();
const queryUrl = "contacts(" + contactId + ")";
const config = {
method: "patch",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
Accept: "application/json",
Prefer: 'odata.include-annotations="*",return=representation',
Authorization: "Bearer " + token.access_token,
"Content-Type": "application/json"
},
data: JSON.stringify(updatePayload)
};
const response = await axios(config);
return response.data;
};
+1 -1
View File
@@ -28,7 +28,7 @@
"case-closed-desc": "Mae PCAC wedi penderfynu ar yr apêl ac mae'r achos bellach wedi'i gau.", "case-closed-desc": "Mae PCAC wedi penderfynu ar yr apêl ac mae'r achos bellach wedi'i gau.",
"case-closed-desc-order": "Mae PCAC wedi penderfynu ar y gorchymyn ac mae'r achos bellach wedi'i gau.", "case-closed-desc-order": "Mae PCAC wedi penderfynu ar y gorchymyn ac mae'r achos bellach wedi'i gau.",
"case-closed-desc-application": "Mae PCAC wedi penderfynu ar yr apêl ac mae'r achos bellach wedi'i gau.", "case-closed-desc-application": "Mae PCAC wedi penderfynu ar yr apêl ac mae'r achos bellach wedi'i gau.",
"case-closed-desc-dnssips": "Mae'r Cais wedi'i benderfynu.", "case-closed-desc-dnssips": "Mae'r achos bellach wedi'i gau. Ni chymerir camau pellach yn yr achos hwn",
"case-closed-desc-callin": "Mae PCAC wedi penderfynu ar y cais a alwyd i mewn ac mae'r achos bellach wedi'i gau.", "case-closed-desc-callin": "Mae PCAC wedi penderfynu ar y cais a alwyd i mewn ac mae'r achos bellach wedi'i gau.",
"appeal-submitted": "Apêl wedi'i Chyflwyno", "appeal-submitted": "Apêl wedi'i Chyflwyno",
"appeal-submitted-desc": "Mae PCAC wedi derbyn yr apêl.", "appeal-submitted-desc": "Mae PCAC wedi derbyn yr apêl.",
+4
View File
@@ -17,6 +17,10 @@
"summary-case-stage-label": "Cam yr Achos", "summary-case-stage-label": "Cam yr Achos",
"summary-environmental-statement-label": "Lleoliad Datganiad Amgylcheddol", "summary-environmental-statement-label": "Lleoliad Datganiad Amgylcheddol",
"summary-last-modified-label": "Addaswyd ddiwethaf", "summary-last-modified-label": "Addaswyd ddiwethaf",
"summary-make-consultation-response-para-a": "Gellir cyflwyno ymatebion i ymgynghoriadau, neu sylwadau, ar gyfer yr achos hwn bellach. I gael rhagor o wybodaeth am gyflwyno sylwadau i PCAC, gweler ein ",
"summary-make-representation-para-a": "Gellir cyflwyno sylwadau, neu gynrychioliadau, ar gyfer yr achos hwn bellach. I gael rhagor o wybodaeth am gyflwyno sylwadau i PCAC, gweler ein ",
"summary-make-representation-para-a-link": "https://www.llyw.cymru/defnyddio-deallusrwydd-artiffisial-ai-mewn-cyflwyniadau-i-pcac",
"summary-make-representation-para-a-label": "Canllawiau ar ddefnyddio Deallusrwydd Artiffisial Cynhyrchiol",
"summary-make-representation-label": "Cyflwyno sylwadau", "summary-make-representation-label": "Cyflwyno sylwadau",
"summary-make-consultation-label": "Cyflwyno Ymateb i'r Ymgynghoriad", "summary-make-consultation-label": "Cyflwyno Ymateb i'r Ymgynghoriad",
"summary-representation-open-label": "Cynrychioliadau yn agor", "summary-representation-open-label": "Cynrychioliadau yn agor",
+3 -1
View File
@@ -20,6 +20,8 @@
"cancel-link": "Canslo", "cancel-link": "Canslo",
"save-exit-button": "Cadw a gadael", "save-exit-button": "Cadw a gadael",
"submit-and-start": "Cyflwyno a dechrau'r cwrs", "submit-and-start": "Cyflwyno a dechrau'r cwrs",
"footer-pedw-use-ai-label": "Sut mae PCAC yn defnyddio deallusrwydd artiffisial (AI)",
"footer-pedw-use-ai-link": "https://www.llyw.cymru/penderfyniadau-cynllunio-ac-amgylchedd-cymru/sut-mae-pcac-yn-defnyddio-deallusrwydd-artiffisial-ai",
"footer-terms-conditions-link-label": "Telerau ac amodau", "footer-terms-conditions-link-label": "Telerau ac amodau",
"footer-terms-conditions-link": "https://llyw.cymru/gwaith-achos-cynllunio-telerau-ac-amodau", "footer-terms-conditions-link": "https://llyw.cymru/gwaith-achos-cynllunio-telerau-ac-amodau",
"footer-privacy-link-label": "Preifatrwydd", "footer-privacy-link-label": "Preifatrwydd",
@@ -32,7 +34,7 @@
"footer-contact-us-link-label": "Cysylltu â ni", "footer-contact-us-link-label": "Cysylltu â ni",
"footer-contact-us-link": "https://llyw.cymru/penderfyndiadau-cynllunio-ac-amgylchedd-cymru/cysylltwch-ni", "footer-contact-us-link": "https://llyw.cymru/penderfyndiadau-cynllunio-ac-amgylchedd-cymru/cysylltwch-ni",
"footer-copyright-link-label": "Datganiad hawlfraint", "footer-copyright-link-label": "Datganiad hawlfraint",
"footer-copyright-link": "https://llyw.cymru/datganiad-hawlfraint", "footer-copyright-link": "https://www.llyw.cymru/penderfyniadau-cynllunio-ac-amgylchedd-cymru/datganiad-hawlfraint",
"footer-alternative-languages-link-label": "Ieithoedd amgen", "footer-alternative-languages-link-label": "Ieithoedd amgen",
"footer-alternative-languages-link": "https://llyw.cymru/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-label": "Canllawiau a gwasanaethau Penderfyniadau Cynllunio ac Amgylchedd Cymru",
+4 -1
View File
@@ -56,7 +56,10 @@
"signin-benefits-paragraph": "Drwy fewngofnodi gyda'r botwm Mewngofnodi, byddwch yn gallu:", "signin-benefits-paragraph": "Drwy fewngofnodi gyda'r botwm Mewngofnodi, byddwch yn gallu:",
"ai-policy-notice-title": "Pwysig: canllawiau ar ddefnyddio cynnwys a gynhyrchir gan AI", "ai-policy-notice-title": "Pwysig: canllawiau ar ddefnyddio cynnwys a gynhyrchir gan AI",
"ai-policy-notice-paragraph-one": "Deellir y gall partïon ddewis defnyddio Deallusrwydd Artiffisial Cynhyrchiol (AI) wrth gyflwyno apeliadau neu gynrychioliadau i PCAC. Er bod gan y rhai sy'n ymgysylltu â PCAC hawl i ddefnyddio AI i gynorthwyo eu cyflwyniadau, dylid nodi y gall cynnwys a gynhyrchir gan AI gynnwys honiadau ffug neu ddi-sail.", "ai-policy-notice-paragraph-one": "Deellir y gall partïon ddewis defnyddio Deallusrwydd Artiffisial Cynhyrchiol (AI) wrth gyflwyno apeliadau neu gynrychioliadau i PCAC. Er bod gan y rhai sy'n ymgysylltu â PCAC hawl i ddefnyddio AI i gynorthwyo eu cyflwyniadau, dylid nodi y gall cynnwys a gynhyrchir gan AI gynnwys honiadau ffug neu ddi-sail.",
"ai-policy-notice-paragraph-two": "Gan y bydd cyflwyniadau ysgrifenedig yn destun craffu yn y broses apelio, o bosibl o dan groesholiad mewn gwrandawiadau ac ymholiadau, ni ddylech wneud cyflwyniadau ysgrifenedig nad ydych yn eu deall neu'n gwybod eu bod yn gywir. Gall cyflwyno tystiolaeth anghywir arwain at gost ddiangen wrth wirio neu wrthbrofi tystiolaeth o'r fath a gallai arwain at ddyfarnu costau yn eich erbyn. Gweler ein Canllawiau ar gyfer defnyddio AI Cynhyrchiol am ragor o wybodaeth.", "ai-policy-notice-paragraph-two": "Gan y bydd cyflwyniadau ysgrifenedig yn destun craffu yn y broses apelio – ac o bosibl yn destun croesholi mewn gwrandawiadau ac ymchwiliadau – ni ddylech wneud cyflwyniadau ysgrifenedig nad ydych yn eu deall neu nad ydych yn gwybod eu bod yn gywir. Gall cyflwyno tystiolaeth anghywir arwain at gostau diangen wrth wirio neu wrthbrofi'r dystiolaeth honno, a gallai arwain at orchymyn i chi dalu costau. Gweler ein ",
"ai-policy-notice-paragraph-two-a-label": "Canllawiau ar ddefnyddio Deallusrwydd Artiffisial (AI) Cynhyrchiol",
"ai-policy-notice-paragraph-two-a-link": "https://www.llyw.cymru/defnyddio-deallusrwydd-artiffisial-ai-mewn-cyflwyniadau-i-pcac",
"ai-policy-notice-paragraph-two-b": " am ragor o wybodaeth.",
"ai-policy-notice-dismiss-button": "Rwy'n deall", "ai-policy-notice-dismiss-button": "Rwy'n deall",
"contact-us-heading": "Cysylltu â ni", "contact-us-heading": "Cysylltu â ni",
"contact-us-paragraph": "Os oes gennych unrhyw ymholiadau ynghylch apêl, cais neu unrhyw beth arall sy'n ymwneud â Gwaith Achos Cynllunio, gallwch gysylltu â ni", "contact-us-paragraph": "Os oes gennych unrhyw ymholiadau ynghylch apêl, cais neu unrhyw beth arall sy'n ymwneud â Gwaith Achos Cynllunio, gallwch gysylltu â ni",
+1 -1
View File
@@ -28,7 +28,7 @@
"case-closed-desc": "PEDW has determined the appeal and the case has now been closed.", "case-closed-desc": "PEDW has determined the appeal and the case has now been closed.",
"case-closed-desc-order": "PEDW has determined the order and the case has now been closed.", "case-closed-desc-order": "PEDW has determined the order and the case has now been closed.",
"case-closed-desc-application": "PEDW has determined the application and the case has now been closed.", "case-closed-desc-application": "PEDW has determined the application and the case has now been closed.",
"case-closed-desc-dnssips": "The Application has been decided.", "case-closed-desc-dnssips": "The case has now been closed. No further action will be taken on this case",
"case-closed-desc-callin": "PEDW has determined the called-in application and the case has now been closed.", "case-closed-desc-callin": "PEDW has determined the called-in application and the case has now been closed.",
"appeal-submitted": "Appeal Submitted", "appeal-submitted": "Appeal Submitted",
"appeal-submitted-desc": "Appeal has been received by PEDW.", "appeal-submitted-desc": "Appeal has been received by PEDW.",
+4
View File
@@ -17,6 +17,10 @@
"summary-case-stage-label": "Case Stage", "summary-case-stage-label": "Case Stage",
"summary-environmental-statement-label": "Environmental Statement Location", "summary-environmental-statement-label": "Environmental Statement Location",
"summary-last-modified-label": "Last modified", "summary-last-modified-label": "Last modified",
"summary-make-consultation-response-para-a": "Consultations responses, or comments, may now be submitted for this case. For further information on making submissions to PEDW, please see our ",
"summary-make-representation-para-a": "Representations, or comments, may now be submitted for this case. For further information on making submissions to PEDW, please see our ",
"summary-make-representation-para-a-link": "https://www.gov.wales/using-ai-submissions-pedw",
"summary-make-representation-para-a-label": "Guidance for the use of Generative AI",
"summary-make-representation-label": "Make representation", "summary-make-representation-label": "Make representation",
"summary-make-consultation-label": "Submit a Consultation Response", "summary-make-consultation-label": "Submit a Consultation Response",
"summary-representation-open-label": "Representations open", "summary-representation-open-label": "Representations open",
+4 -2
View File
@@ -20,6 +20,8 @@
"cancel-link": "Cancel", "cancel-link": "Cancel",
"save-exit-button": "Save and exit", "save-exit-button": "Save and exit",
"submit-and-start": "Submit and start course", "submit-and-start": "Submit and start course",
"footer-pedw-use-ai-label": "How PEDW uses AI",
"footer-pedw-use-ai-link": "https://www.gov.wales/planning-and-environment-decisions-wales/how-pedw-uses-ai",
"footer-terms-conditions-link-label": "Terms and conditions", "footer-terms-conditions-link-label": "Terms and conditions",
"footer-terms-conditions-link": "https://gov.wales/planning-casework-terms-and-conditions", "footer-terms-conditions-link": "https://gov.wales/planning-casework-terms-and-conditions",
"footer-privacy-link-label": "Privacy", "footer-privacy-link-label": "Privacy",
@@ -30,9 +32,9 @@
"footer-accessibility-link": "/accessibility", "footer-accessibility-link": "/accessibility",
"footer-feedback-link": "Give feedback about this page", "footer-feedback-link": "Give feedback about this page",
"footer-contact-us-link-label": "Contact us", "footer-contact-us-link-label": "Contact us",
"footer-contact-us-link": "https://gov.wales/planning-and-environment-decisions-wales/contact-us", "footer-contact-us-link": "https://www.gov.wales/planning-and-environment-decisions-wales/contact-us",
"footer-copyright-link-label": "Copyright statement", "footer-copyright-link-label": "Copyright statement",
"footer-copyright-link": "https://gov.wales/copyright-statement", "footer-copyright-link": "https://www.gov.wales/planning-and-environment-decisions-wales/copyright-statement",
"footer-alternative-languages-link-label": "Alternative languages", "footer-alternative-languages-link-label": "Alternative languages",
"footer-alternative-languages-link": "https://gov.wales/alternative-languages", "footer-alternative-languages-link": "https://gov.wales/alternative-languages",
"footer-guidance-link-label": "Planning and Environment Decisions Wales’ guidance and services", "footer-guidance-link-label": "Planning and Environment Decisions Wales’ guidance and services",
+4 -1
View File
@@ -56,7 +56,10 @@
"signin-benefits-paragraph": "By signing in with the Sign in button, you will be able to:", "signin-benefits-paragraph": "By signing in with the Sign in button, you will be able to:",
"ai-policy-notice-title": "Important: guidance on use of AI-generated content", "ai-policy-notice-title": "Important: guidance on use of AI-generated content",
"ai-policy-notice-paragraph-one": "It is understood that parties may choose to make use of Generative Artificial Intelligence (AI) when submitting appeals or representations to PEDW. While those engaging with PEDW are entitled to use AI to aid their submissions, it should be noted that content generated by an AI may include false or unsubstantiated claims.", "ai-policy-notice-paragraph-one": "It is understood that parties may choose to make use of Generative Artificial Intelligence (AI) when submitting appeals or representations to PEDW. While those engaging with PEDW are entitled to use AI to aid their submissions, it should be noted that content generated by an AI may include false or unsubstantiated claims.",
"ai-policy-notice-paragraph-two": "As written submissions will be subject to scrutiny in the appeals process, potentially under cross-examination at hearings and inquiries, you should not make written submissions that you do not understand or know to be accurate. The submission of inaccurate evidence may incur unnecessary expense verifying or rebutting such evidence and could lead to an award of costs against you. Please see our Guidance for the use of Generative AI for further information.", "ai-policy-notice-paragraph-two": "As written submissions will be subject to scrutiny in the appeals process, potentially under cross-examination at hearings and inquiries, you should not make written submissions that you do not understand or know to be accurate. The submission of inaccurate evidence may incur unnecessary expense verifying or rebutting such evidence and could lead to an award of costs against you. Please see our ",
"ai-policy-notice-paragraph-two-a-label": "Guidance for the use of Generative AI",
"ai-policy-notice-paragraph-two-a-link": "https://www.gov.wales/using-ai-submissions-pedw",
"ai-policy-notice-paragraph-two-b": " for further information.",
"ai-policy-notice-dismiss-button": "I understand", "ai-policy-notice-dismiss-button": "I understand",
"contact-us-heading": "Contact us", "contact-us-heading": "Contact us",
"contact-us-paragraph": "If you have any queries on an appeal, application or anything else regarding Planning Caserwork you can contact us", "contact-us-paragraph": "If you have any queries on an appeal, application or anything else regarding Planning Caserwork you can contact us",
+1 -1
View File
@@ -63,7 +63,7 @@ export function middleware(request) {
); );
// XSS protection (legacy) // XSS protection (legacy)
response.headers.set("X-XSS-Protection", "1; mode=block"); response.headers.set("X-XSS-Protection", "0");
// Prevent MIME type sniffing // Prevent MIME type sniffing
response.headers.set("X-Content-Type-Options", "nosniff"); response.headers.set("X-Content-Type-Options", "nosniff");
+3 -1
View File
@@ -1,5 +1,7 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/image-types/global" /> /// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";
import "./.next/types/root-params.d.ts";
// NOTE: This file should not be edited // NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
+32 -7
View File
@@ -46,29 +46,30 @@ const securityHeaders = [
}, },
{ {
key: "X-XSS-Protection", key: "X-XSS-Protection",
value: "1; mode=block" value: "0"
} }
// { // {
// key: "Content-Security-Policy", // key: "Content-Security-Policy",
// value: "frame-src 'self'; child-src 'self';object-src 'none'; script-src 'self' 'https://www.googletagmanager.com' unsafe-inline", // value: "frame-src 'self'; child-src 'self';object-src 'none'; script-src 'self' 'https://www.googletagmanager.com' unsafe-inline",
// }, // },
]; ];
const noStoreHeaders = [
{
key: "Cache-Control",
value: "no-store"
}
];
//const buildId = nextBuildId.sync({ dir: __dirname }); //const buildId = nextBuildId.sync({ dir: __dirname });
const buildId = Date.now().toString(); const buildId = Date.now().toString();
module.exports = { module.exports = {
//output: "standalone", //output: "standalone",
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true
},
reactStrictMode: false, reactStrictMode: false,
env: { env: {
BUILD_ID_ENV: buildId BUILD_ID_ENV: buildId
}, },
swcMinify: false,
sassOptions: { sassOptions: {
quietDeps: true,
includePaths: [ includePaths: [
"/styles/sass", "/styles/sass",
"node_modules/govuk-frontend/govuk/all", "node_modules/govuk-frontend/govuk/all",
@@ -82,6 +83,30 @@ module.exports = {
// Apply these headers to all routes in your application. // Apply these headers to all routes in your application.
source: "/(.*)?", source: "/(.*)?",
headers: securityHeaders headers: securityHeaders
},
{
source:
"/api/:family(admin|email|file|myportal|subscriptions)/:path*",
headers: noStoreHeaders
},
{
source: "/api/auth/resolve-locale",
headers: noStoreHeaders
},
{
source:
"/api/endpoint/:route(createaccount_api|getaccounts_api|getemailaccountcheck_api|getpersonalaccount_api|getportallogin_api|getportalloginproxy_api|getpreferredlanguage_api|updateaccount_api|gethash_api|createcrmtask_api)",
headers: noStoreHeaders
},
{
source:
"/api/endpoint/:route(getmycases_api|getmylpacases_api|getmyrepresentations_api|getmyrepresentationsproxy_api|getawaitingsubmission_api|getawaitingsubmissionproxy_api|getwatchedcases_api|getwatchedcasesproxy_api|createwatchedcases_api|deletewatchedcases_api|deletewatchedcasesproxy_api|deleteawaitingsubmissions_api)",
headers: noStoreHeaders
},
{
source:
"/api/endpoint/:route(getbasicpartsaveddetails_api|getpartsavedappeal_api|getappealid_api|getappealpdfdocuments_api|getportalmoduledetails_api|getportalmoduledetailsproxy_api|patchcase_api|updatecase_api)",
headers: noStoreHeaders
} }
]; ];
}, },
+2803 -4092
View File
File diff suppressed because it is too large Load Diff
+31 -29
View File
@@ -2,66 +2,70 @@
"name": "acp", "name": "acp",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"overrides": {
"webpack": {
"terser-webpack-plugin": {
".": "5.3.17",
"schema-utils": "4.3.0"
}
}
},
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev --webpack",
"debugdev": "NODE_OPTIONS='--inspect' next dev", "debugdev": "NODE_OPTIONS='--inspect' next dev",
"dev:app": "node ./server/server.js", "dev:app": "node ./server/server.js",
"build": "NODE_ENV=production node_modules/next/dist/bin/next build", "build": "NODE_ENV=production node_modules/next/dist/bin/next build --webpack",
"start2": "NODE_ENV=production node ./server.js", "start2": "NODE_ENV=production node ./server.js",
"start3": "NODE_ENV=production next start", "start3": "NODE_ENV=production next start",
"start": "NODE_ENV=production node_modules/next/dist/bin/next start", "start": "NODE_ENV=production node_modules/next/dist/bin/next start",
"lint": "next lint", "lint": "eslint .",
"prisma:generate": "prisma generate", "prisma:generate": "prisma generate",
"test:reps": "cd '../../welsh government/Playwright/Playwright' && npx playwright test tests/loggedin/raiserep.spec.js --headed", "test": "playwright test",
"test:newappeal": "cd '../../welsh government/Playwright/Playwright' && npx playwright test tests/loggedin/newappeal.spec.js --headed" "test:reps": "playwright test pwe2e/tests/loggedin/raiserep.spec.js --headed",
"test:newappeal": "playwright test pwe2e/tests/loggedin/newappeal.spec.js --headed",
"test:headed": "playwright test --headed",
"install:browsers": "playwright install chromium"
}, },
"browser": { "browser": {
"child_process": false "child_process": false
}, },
"dependencies": { "dependencies": {
"@auth/prisma-adapter": "^1.0.10", "@azure/identity": "4.14.1",
"@azure/identity": "^4.0.0",
"@azure/storage-blob": "^12.17.0", "@azure/storage-blob": "^12.17.0",
"@azure/storage-queue": "^12.16.0", "@azure/storage-queue": "^12.16.0",
"@microsoft/applicationinsights-react-js": "^17.3.2", "@microsoft/applicationinsights-react-js": "^17.3.2",
"@microsoft/applicationinsights-web": "^3.3.2", "@microsoft/applicationinsights-web": "^3.3.2",
"@next-auth/prisma-adapter": "^1.0.7", "@next-auth/prisma-adapter": "^1.0.7",
"@next/third-parties": "latest", "@next/third-parties": "16.4.4",
"@prisma/client": "^5.7.0", "@prisma/client": "^5.7.0",
"@react-pdf/renderer": "^3.1.14", "@react-pdf/renderer": "^3.1.14",
"@redux-devtools/extension": "^3.3.0", "@redux-devtools/extension": "^3.3.0",
"@xmldom/xmldom": "^0.8.10", "@xmldom/xmldom": "^0.8.10",
"applicationinsights": "^2.9.1", "axios": "^1.21.0",
"axios": "^1.7.7", "cookie": "0.7.2",
"compression": "^1.7.4",
"cookie-cutter": "^0.2.0", "cookie-cutter": "^0.2.0",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"date-fns": "^2.30.0", "date-fns": "^2.30.0",
"dom": "^0.0.3", "dom": "^0.0.3",
"express": "^4.18.2", "express": "^4.22.3",
"file-type": "^20.4.1", "file-type": "22.3.0",
"fs": "0.0.2", "fs": "0.0.2",
"google-map-react": "^2.2.1", "google-map-react": "^2.2.1",
"govuk-frontend": "^5.0.0", "govuk-frontend": "^5.0.0",
"history": "^5.3.0", "history": "^5.3.0",
"jsonpath": "^1.1.1",
"jsonpath-plus": "^10.3.0", "jsonpath-plus": "^10.3.0",
"leaflet": "^1.9.4", "leaflet": "^1.9.4",
"leaflet-defaulticon-compatibility": "^0.1.2", "leaflet-defaulticon-compatibility": "^0.1.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"moment": "^2.29.4",
"multiparty": "^4.2.3", "multiparty": "^4.2.3",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"next": "^14.2.28", "next": "16.4.4",
"next-auth": "^4.24.4", "next-auth": "4.24.15",
"next-build-id": "^3.0.0", "next-build-id": "^3.0.0",
"next-connect": "^0.12.2", "next-connect": "^0.12.2",
"next-redux-wrapper": "^7.0.5", "next-redux-wrapper": "^7.0.5",
"next-swagger-doc": "^0.4.0",
"next-translate": "^2.6.2", "next-translate": "^2.6.2",
"next-translate-plugin": "^2.6.2", "next-translate-plugin": "^2.6.2",
"nodemailer": "^6.9.7",
"nookies": "^2.5.2",
"notifications-node-client": "^7.0.6", "notifications-node-client": "^7.0.6",
"openapi-types": "^12.1.3", "openapi-types": "^12.1.3",
"ospoint": "^0.2.1", "ospoint": "^0.2.1",
@@ -72,15 +76,13 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-accessible-accordion": "^5.0.0", "react-accessible-accordion": "^5.0.0",
"react-autosuggest": "^10.1.0", "react-autosuggest": "^10.1.0",
"react-cookie-consent": "^9.0.0", "react-cookie-consent": "^10.0.2",
"react-datepicker": "4.24.0", "react-datepicker": "4.24.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3", "react-dropzone": "^14.2.3",
"react-idle-timer": "^5.7.2", "react-idle-timer": "^5.7.2",
"react-leaflet": "^4.2.1", "react-leaflet": "^4.2.1",
"react-pdf": "^7.6.0",
"react-pdf-html": "^1.1.18", "react-pdf-html": "^1.1.18",
"react-quill": "^2.0.0",
"react-quill-new": "^3.3.3", "react-quill-new": "^3.3.3",
"react-redux": "^7.2.6", "react-redux": "^7.2.6",
"redux": "^4.2.1", "redux": "^4.2.1",
@@ -89,12 +91,11 @@
"redux-thunk": "^2.4.2", "redux-thunk": "^2.4.2",
"sass": "1.69", "sass": "1.69",
"sass-loader": "13.3.2", "sass-loader": "13.3.2",
"swagger-ui": "^5.18.2", "set-cookie-parser": "2.7.0",
"swagger-ui-react": "^5.18.2",
"tslib": "^2.7.0", "tslib": "^2.7.0",
"typescript": "^5.3.2", "typescript": "^5.3.2",
"uuid": "9.0.0", "uuid": "11.1.1",
"webpack": "^5.66.0", "webpack": "5.112.2",
"xpath": "^0.0.32" "xpath": "^0.0.32"
}, },
"resolutions": { "resolutions": {
@@ -102,8 +103,9 @@
"@react-pdf/pdfkit": "3.1.0" "@react-pdf/pdfkit": "3.1.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.57.0", "@playwright/test": "^1.62.1",
"eslint-config-next": "^14.2.28", "eslint": "9.39.5",
"eslint-config-next": "16.4.4",
"eslint-plugin-jsdoc": "^48.2.3", "eslint-plugin-jsdoc": "^48.2.3",
"prisma": "^5.0.0" "prisma": "^5.0.0"
} }
+1 -1
View File
@@ -2,7 +2,7 @@ import Document, { Html, Head, Main, NextScript } from "next/document";
import SkipLink from "../components/skiplink"; import SkipLink from "../components/skiplink";
import { Tracking, TrackingNoScript } from "../components/tracking"; import { Tracking, TrackingNoScript } from "../components/tracking";
//import { nanoid } from "nanoid"; //import { nanoid } from "nanoid";
import { setCookie } from "nookies"; import { setCookie } from "../lib/cookies";
import Script from "next/script"; import Script from "next/script";
class MyDocument extends Document { class MyDocument extends Document {
+1 -1
View File
@@ -4,7 +4,7 @@ import Link from "next/link";
import CookieBanner from "../components/cookieBanner"; import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer"; import Footer from "../components/footer";
import Header from "../components/header"; import Header from "../components/header";
import { parseCookies, setCookie, destroyCookie } from "nookies"; import { parseCookies, setCookie, destroyCookie } from "../lib/cookies";
import { useSession, signIn, signOut } from "next-auth/react"; import { useSession, signIn, signOut } from "next-auth/react";
function Error({ statusCode }, props) { function Error({ statusCode }, props) {
-120
View File
@@ -1,120 +0,0 @@
import Link from "next/link";
import _ from "lodash";
import Head from "next/head";
import Header from "../../components/header";
import Banner from "../../components/banner";
import CookieBanner from "../../components/cookieBanner";
import Breadcrumbs from "../../components/breadcrumbs";
import Footer from "../../components/footer";
import { useSelector, shallowEqual, connect } from "react-redux";
import { wrapper } from "../../store/store";
import { useRouter } from "next/router";
import { useState } from "react";
import useTranslation from "next-translate/useTranslation";
import { JSONPath as jsonpath } from "jsonpath-plus";
import { reduxForm, formValueSelector } from "redux-form";
import ChangePassword from "../../components/account/changepassword";
import xpath from "xpath";
import {
setAppealType,
setAppealTypeTitle,
setAppealTypeID,
setAppealLPA,
getAppealTypeObj
} from "../../store/appealType/action";
import {
getAppealsTypes,
getLPA
} from "../../actions/services/referenceDataService";
import { setLPA } from "../../store/lpa/action";
import { getSession, useSession } from "next-auth/react";
import NoSessionWarning from "../../components/nosession";
const Home = (props) => {
const { footerLinks, pages, formData } = props;
let { t, lang } = useTranslation();
const router = useRouter();
const { locale } = router;
const { appealtypes } = router.query;
const { appealType, LPAData } = props;
const [passwordUpdated, setPasswordUpdated] = useState(false);
const { data: session, status } = useSession();
if (status === "loading") {
return <NoSessionWarning loading={true} />;
}
if (status === "unauthenticated") {
router.push("/auth/signin");
return <NoSessionWarning />;
}
return (
<div>
<Head>
<title>
{t("search:page-title")} - {t("common:service-name")}
</title>
</Head>
<div id="page_wrapper">
<CookieBanner />
<Header />
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="govuk-width-container">
<Breadcrumbs slug={appealtypes} props={props} />
<main
className="govuk-main-wrapper--auto-spacing"
id="main-content"
role="main"
>
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
{passwordUpdated == true ? (
<h1>
Your password has been changed
</h1>
) : (
<h1>Change password</h1>
)}
<ChangePassword
props={props}
setPasswordUpdated={
setPasswordUpdated
}
passwordUpdated={passwordUpdated}
/>
</div>
</div>
</main>
</div>
</div>
</div>
<Footer footerLinks={footerLinks} ticketnumber={props} />
</div>
</div>
);
};
const mapStateToProps = (state) => {
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
LPAData: state.LPAData,
form: state.form,
accountDetails: state.accountDetails
};
};
export default connect(mapStateToProps)(Home);
+1 -1
View File
@@ -20,7 +20,7 @@ import { reduxForm, formValueSelector } from "redux-form";
import PersonalDetails from "../../components/account/personaldetails"; import PersonalDetails from "../../components/account/personaldetails";
import { setAccountDetails } from "../../store/accountDetails/action"; import { setAccountDetails } from "../../store/accountDetails/action";
import { getPersonalAccount } from "../../actions/services/accountService"; import { getPersonalAccount } from "../../actions/services/accountService";
import { setCookie } from "nookies"; import { setCookie } from "../../lib/cookies";
import { getSession, useSession } from "next-auth/react"; import { getSession, useSession } from "next-auth/react";
import NoSessionWarning from "../../components/nosession"; import NoSessionWarning from "../../components/nosession";
+44
View File
@@ -1,6 +1,7 @@
// pages/admin/storage.js // pages/admin/storage.js
import { useState } from "react"; import { useState } from "react";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router";
import CookieBanner from "../../components/cookieBanner"; import CookieBanner from "../../components/cookieBanner";
import Header from "../../components/header"; import Header from "../../components/header";
import Footer from "../../components/footer"; import Footer from "../../components/footer";
@@ -29,6 +30,10 @@ import {
setSearchResults setSearchResults
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
import { setCurrentPage } from "../../store/currentView/action"; import { setCurrentPage } from "../../store/currentView/action";
import {
readAdminSessionCookie,
validateAdminSession
} from "../../lib/admin/adminAuth";
const StoragePage = (props) => { const StoragePage = (props) => {
const { const {
@@ -42,6 +47,27 @@ const StoragePage = (props) => {
statusLPAObj statusLPAObj
} = props; } = props;
const [whichTab, setWhichTab] = useState("appealDashboard"); const [whichTab, setWhichTab] = useState("appealDashboard");
const [signingOut, setSigningOut] = useState(false);
const router = useRouter();
const handleSignOut = async () => {
setSigningOut(true);
try {
const response = await fetch("/api/admin/auth/logout", {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "same-origin"
});
if (response.ok) {
await router.replace("/admin/login");
return;
}
} finally {
setSigningOut(false);
}
};
return ( return (
<div> <div>
@@ -57,6 +83,16 @@ const StoragePage = (props) => {
style={{ width: "90%", margin: "auto" }} style={{ width: "90%", margin: "auto" }}
> >
<div className="js-enabled govuk-template__body govuk-frontend-supported"> <div className="js-enabled govuk-template__body govuk-frontend-supported">
<div className="govuk-!-margin-top-4 govuk-!-text-align-right">
<button
type="button"
className="govuk-button govuk-button--secondary"
onClick={handleSignOut}
disabled={signingOut}
>
{signingOut ? "Signing out..." : "Sign out"}
</button>
</div>
<div className="govuk-tabs" data-module="govuk-tabs"> <div className="govuk-tabs" data-module="govuk-tabs">
<h2 className="govuk-tabs__title">Contents</h2> <h2 className="govuk-tabs__title">Contents</h2>
@@ -199,6 +235,14 @@ const StoragePage = (props) => {
export const getServerSideProps = wrapper.getServerSideProps( export const getServerSideProps = wrapper.getServerSideProps(
(store) => async (ctx) => { (store) => async (ctx) => {
const { query, req, res } = ctx; const { query, req, res } = ctx;
const adminSession = readAdminSessionCookie(req);
if (!validateAdminSession(adminSession)) {
return {
redirect: { destination: "/admin/login", permanent: false }
};
}
// IP restriction check // IP restriction check
const ALLOWED_IPS = process.env.ALLOWED_IPS const ALLOWED_IPS = process.env.ALLOWED_IPS
? process.env.ALLOWED_IPS.split(",").map((ip) => ip.trim()) ? process.env.ALLOWED_IPS.split(",").map((ip) => ip.trim())
+155
View File
@@ -0,0 +1,155 @@
import Head from "next/head";
import { useRouter } from "next/router";
import { useState } from "react";
import CookieBanner from "../../components/cookieBanner";
import Footer from "../../components/footer";
import Header from "../../components/header";
import {
readAdminSessionCookie,
validateAdminSession
} from "../../lib/admin/adminAuth";
const AdminLoginPage = () => {
const router = useRouter();
const [passphrase, setPassphrase] = useState("");
const [error, setError] = useState("");
const [submitting, setSubmitting] = useState(false);
const handleSubmit = async (event) => {
event.preventDefault();
setError("");
setSubmitting(true);
try {
const response = await fetch("/api/admin/auth/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
credentials: "same-origin",
body: JSON.stringify({ passphrase })
});
if (!response.ok) {
setError("Sign in failed. Check the details and try again.");
return;
}
await router.replace("/admin");
} catch (_error) {
setError("Sign in failed. Check the details and try again.");
} finally {
setSubmitting(false);
}
};
return (
<div>
<Head>
<title>Administrative sign in</title>
</Head>
<div id="page_wrapper">
<CookieBanner />
<Header />
<main
className="govuk-width-container govuk-main-wrapper govuk-!-padding-bottom-9"
id="main-content"
>
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
<h1 className="govuk-heading-l">
Administrative sign in
</h1>
{error && (
<div
className="govuk-error-summary"
role="alert"
aria-labelledby="admin-login-error-title"
tabIndex={-1}
>
<h2
className="govuk-error-summary__title"
id="admin-login-error-title"
>
There is a problem
</h2>
<div className="govuk-error-summary__body">
<p>{error}</p>
</div>
</div>
)}
<form onSubmit={handleSubmit} noValidate>
<div
className={`govuk-form-group${
error ? " govuk-form-group--error" : ""
}`}
>
<label
className="govuk-label govuk-label--m"
htmlFor="admin-passphrase"
>
Password
</label>
{error && (
<p
id="admin-passphrase-error"
className="govuk-error-message"
>
<span className="govuk-visually-hidden">
Error:
</span>{" "}
{error}
</p>
)}
<input
className={`govuk-input${
error ? " govuk-input--error" : ""
}`}
id="admin-passphrase"
name="passphrase"
type="password"
autoComplete="current-password"
value={passphrase}
onChange={(event) =>
setPassphrase(event.target.value)
}
aria-describedby={
error
? "admin-passphrase-error"
: undefined
}
aria-invalid={error ? "true" : undefined}
disabled={submitting}
required
/>
</div>
<button
className="govuk-button"
type="submit"
disabled={submitting}
>
{submitting ? "Signing in..." : "Sign in"}
</button>
</form>
</div>
</div>
</main>
<Footer />
</div>
</div>
);
};
export const getServerSideProps = async ({ req }) => {
const adminSession = readAdminSessionCookie(req);
if (validateAdminSession(adminSession)) {
return {
redirect: { destination: "/admin", permanent: false }
};
}
return { props: {} };
};
export default AdminLoginPage;
+39
View File
@@ -0,0 +1,39 @@
import {
createAdminSessionCookie,
hasTrustedSameOrigin,
issueAdminSession,
setAdminAuthNoStore,
validateAdminPassphrase
} from "../../../../lib/admin/adminAuth";
import { respondError, respondSuccess } from "../../middleware/apiResponse";
const forbidden = (res) =>
respondError(res, {
status: 403,
code: "FORBIDDEN",
message: "Request not permitted"
});
export default async function handler(req, res) {
setAdminAuthNoStore(res);
res.setHeader("Allow", "POST");
if (req.method !== "POST") {
return respondError(res, {
status: 405,
code: "METHOD_NOT_ALLOWED",
message: "Method not allowed"
});
}
if (!hasTrustedSameOrigin(req)) return forbidden(res);
const passphrase = req.body?.passphrase;
if (!validateAdminPassphrase(passphrase)) return forbidden(res);
const token = issueAdminSession();
if (!token) return forbidden(res);
res.setHeader("Set-Cookie", createAdminSessionCookie(token));
return respondSuccess(res, { authenticated: true });
}
+30
View File
@@ -0,0 +1,30 @@
import {
createClearedAdminSessionCookie,
hasTrustedSameOrigin,
setAdminAuthNoStore
} from "../../../../lib/admin/adminAuth";
import { respondError, respondSuccess } from "../../middleware/apiResponse";
export default async function handler(req, res) {
setAdminAuthNoStore(res);
res.setHeader("Allow", "POST");
if (req.method !== "POST") {
return respondError(res, {
status: 405,
code: "METHOD_NOT_ALLOWED",
message: "Method not allowed"
});
}
if (!hasTrustedSameOrigin(req)) {
return respondError(res, {
status: 403,
code: "FORBIDDEN",
message: "Request not permitted"
});
}
res.setHeader("Set-Cookie", createClearedAdminSessionCookie());
return respondSuccess(res, { authenticated: false });
}
+24
View File
@@ -0,0 +1,24 @@
import {
readAdminSessionCookie,
setAdminAuthNoStore,
validateAdminSession
} from "../../../../lib/admin/adminAuth";
import { respondError, respondSuccess } from "../../middleware/apiResponse";
export default async function handler(req, res) {
setAdminAuthNoStore(res);
res.setHeader("Allow", "GET");
if (req.method !== "GET") {
return respondError(res, {
status: 405,
code: "METHOD_NOT_ALLOWED",
message: "Method not allowed"
});
}
const token = readAdminSessionCookie(req);
return respondSuccess(res, {
authenticated: validateAdminSession(token)
});
}
@@ -0,0 +1,82 @@
import { createRepCompleteMessage } from "../../../actions/azurestorage";
import { consoleLogger } from "../../../actions/core/logger";
import {
hasTrustedSameOrigin,
readAdminSessionCookie,
setAdminAuthNoStore,
validateAdminSession
} from "../../../lib/admin/adminAuth";
import { respondError, respondSuccess } from "../middleware/apiResponse";
const forbidden = (res) =>
respondError(res, {
status: 403,
code: "FORBIDDEN",
message: "Request not permitted"
});
const isValidContainer = (value) =>
typeof value === "string" &&
value.length >= 3 &&
value.length <= 63 &&
/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(value);
const isValidPathSegment = (value) =>
typeof value === "string" &&
value.length > 0 &&
value.length <= 255 &&
value === value.trim() &&
value !== "." &&
value !== ".." &&
!/[\\/\u0000-\u001f\u007f]/.test(value);
export default async function handler(req, res) {
setAdminAuthNoStore(res);
res.setHeader("Allow", "POST");
if (req.method !== "POST") {
return respondError(res, {
status: 405,
code: "METHOD_NOT_ALLOWED",
message: "Method not allowed"
});
}
const adminSession = readAdminSessionCookie(req);
if (!validateAdminSession(adminSession)) {
return forbidden(res);
}
if (!hasTrustedSameOrigin(req)) {
return forbidden(res);
}
const { container, tempcaseref, repid } = req.body ?? {};
if (
!isValidContainer(container) ||
!isValidPathSegment(tempcaseref) ||
!isValidPathSegment(repid)
) {
return respondError(res, {
status: 400,
code: "INVALID_REQUEST",
message: "Invalid request"
});
}
try {
const data = await createRepCompleteMessage(
container,
tempcaseref,
repid
);
return respondSuccess(res, data);
} catch (error) {
consoleLogger(error);
return respondError(res, {
status: 400,
code: "CREATE_REP_COMPLETE_MESSAGE_FAILED",
message: "Failed to create representation complete message"
});
}
}
+71
View File
@@ -0,0 +1,71 @@
import { deleteBlobCase } from "../../../actions/azurestorage";
import {
hasTrustedSameOrigin,
readAdminSessionCookie,
setAdminAuthNoStore,
validateAdminSession
} from "../../../lib/admin/adminAuth";
import { respondError, respondSuccess } from "../middleware/apiResponse";
const forbidden = (res) =>
respondError(res, {
status: 403,
code: "FORBIDDEN",
message: "Request not permitted"
});
const isValidContainer = (value) =>
typeof value === "string" &&
value.length >= 3 &&
value.length <= 63 &&
/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(value);
const isValidPathSegment = (value) =>
typeof value === "string" &&
value.length > 0 &&
value.length <= 255 &&
value === value.trim() &&
value !== "." &&
value !== ".." &&
!/[\\/\u0000-\u001f\u007f]/.test(value);
export default async function handler(req, res) {
setAdminAuthNoStore(res);
res.setHeader("Allow", "POST");
if (req.method !== "POST") {
return respondError(res, {
status: 405,
code: "METHOD_NOT_ALLOWED",
message: "Method not allowed"
});
}
const adminSession = readAdminSessionCookie(req);
if (
!validateAdminSession(adminSession) ||
!hasTrustedSameOrigin(req)
) {
return forbidden(res);
}
const { container, casefolderID } = req.body ?? {};
if (!isValidContainer(container) || !isValidPathSegment(casefolderID)) {
return respondError(res, {
status: 400,
code: "INVALID_REQUEST",
message: "Invalid request"
});
}
try {
const data = await deleteBlobCase(container, casefolderID);
return respondSuccess(res, { data });
} catch (_error) {
return respondError(res, {
status: 400,
code: "DELETE_BLOB_CASE_FAILED",
message: "Unable to delete blob case"
});
}
}
+78
View File
@@ -0,0 +1,78 @@
import { deleteBlobRep } from "../../../actions/azurestorage";
import {
hasTrustedSameOrigin,
readAdminSessionCookie,
setAdminAuthNoStore,
validateAdminSession
} from "../../../lib/admin/adminAuth";
import { respondError, respondSuccess } from "../middleware/apiResponse";
const forbidden = (res) =>
respondError(res, {
status: 403,
code: "FORBIDDEN",
message: "Request not permitted"
});
const isValidContainer = (value) =>
typeof value === "string" &&
value.length >= 3 &&
value.length <= 63 &&
/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(value);
const isValidPathSegment = (value) =>
typeof value === "string" &&
value.length > 0 &&
value.length <= 255 &&
value === value.trim() &&
value !== "." &&
value !== ".." &&
!/[\\/\u0000-\u001f\u007f]/.test(value);
export default async function handler(req, res) {
setAdminAuthNoStore(res);
res.setHeader("Allow", "POST");
if (req.method !== "POST") {
return respondError(res, {
status: 405,
code: "METHOD_NOT_ALLOWED",
message: "Method not allowed"
});
}
const adminSession = readAdminSessionCookie(req);
if (
!validateAdminSession(adminSession) ||
!hasTrustedSameOrigin(req)
) {
return forbidden(res);
}
const { container, casefolderID, repfile } = req.body ?? {};
if (
!isValidContainer(container) ||
!isValidPathSegment(casefolderID) ||
!isValidPathSegment(repfile)
) {
return respondError(res, {
status: 400,
code: "INVALID_REQUEST",
message: "Invalid request"
});
}
try {
const data = await deleteBlobRep(
container,
`${casefolderID}/${repfile}`
);
return respondSuccess(res, { data });
} catch (_error) {
return respondError(res, {
status: 400,
code: "DELETE_BLOB_REP_FAILED",
message: "Unable to delete blob representation"
});
}
}

Some files were not shown because too many files have changed in this diff Show More