Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions model/src/data-model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,5 @@ export type FormDefinition = {
returnTo?: boolean | undefined;
documentUploadApiUrl?: string | undefined;
secureFormSubmissionConfig: SecureFormSubmissionConfig;
error500ContactEmail?: string | undefined;
};
1 change: 1 addition & 0 deletions model/src/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ export const Schema = joi
returnTo: joi.boolean().optional(),
documentUploadApiUrl: joi.string().optional(),
secureFormSubmissionConfig: secureFormSubmissionConfig.optional(),
error500ContactEmail: joi.string().optional(),
});

/**
Expand Down
3 changes: 2 additions & 1 deletion runner/src/server/forms/kls-enquiries.json
Original file line number Diff line number Diff line change
Expand Up @@ -2714,5 +2714,6 @@
"url": "https://submit.forms.service.gov.uk/form/7932/give-feedback-on-knowledge-and-library-services-kls/30055"
},
"showFilenamesOnSummaryPage": true,
"jwtKey": "${KLSJwtKey}"
"jwtKey": "${KLSJwtKey}",
"error500ContactEmail": "libraries@kls.ukhsa.gov.uk"
}
3 changes: 2 additions & 1 deletion runner/src/server/forms/kls-magic-link.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,6 @@
"url": "https://submit.forms.service.gov.uk/form/7932/give-feedback-on-knowledge-and-library-services-kls/30055"
},
"version": 2,
"conditions": []
"conditions": [],
"error500ContactEmail": "libraries@kls.ukhsa.gov.uk"
}
3 changes: 2 additions & 1 deletion runner/src/server/forms/kls-training-magic-link.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,6 @@
"maxAttempts": 3,
"showPaymentSkippedWarningPage": false
},
"jwtKey": "${KLSTrainingJwtKey}"
"jwtKey": "${KLSTrainingJwtKey}",
"error500ContactEmail": "libraries@kls.ukhsa.gov.uk"
}
3 changes: 2 additions & 1 deletion runner/src/server/forms/kls-training-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -1086,5 +1086,6 @@
"feedbackForm": true,
"url": "https://submit.forms.service.gov.uk/form/7932/give-feedback-on-knowledge-and-library-services-kls/30055"
},
"jwtKey": "${KLSTrainingJwtKey}"
"jwtKey": "${KLSTrainingJwtKey}",
"error500ContactEmail": "libraries@kls.ukhsa.gov.uk"
}
9 changes: 6 additions & 3 deletions runner/src/server/plugins/errorPages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HapiRequest, HapiResponseToolkit } from "../types";
import { HapiRequest, HapiResponseToolkit, HapiServer } from "../types";
import config from "../config";

/*
Expand All @@ -7,7 +7,7 @@ import config from "../config";
export default {
plugin: {
name: "error-pages",
register: (server) => {
register: (server: HapiServer) => {
server.ext(
"onPreResponse",
(request: HapiRequest, h: HapiResponseToolkit) => {
Expand Down Expand Up @@ -47,7 +47,10 @@ export default {

// The return the `500` view
return h
.view("500", { name: form.name || config.serviceName })
.view("500", {
name: form?.name || config.serviceName,
contactEmail: form?.def.error500ContactEmail,
})
.code(statusCode);
}
return h.continue;
Expand Down
3 changes: 2 additions & 1 deletion runner/src/server/plugins/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FeedbackContextInfo, RelativeUrl } from "./engine/feedback";

import fs from "fs";
import path from "path";
import { Server } from "@hapi/hapi";

const routes = [...publicRoutes, healthCheckRoute];

Expand All @@ -30,7 +31,7 @@ interface CookiePayload {
export default {
plugin: {
name: "router",
register: (server) => {
register: (server: Server) => {
server.route(routes);
server.route([
{
Expand Down
7 changes: 6 additions & 1 deletion runner/src/server/views/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">Sorry, there is a problem with the service</h1>
<p class="govuk-body">Contact your closest consulate.</p>

{% if contactEmail %}
<p class="govuk-body">Contact <a href="mailto:{{contactEmail}}">{{contactEmail}}</a>.</p>
{% else %}
<p class="govuk-body">Contact your closest consulate.</p>
{% endif %}
</div>
</div>
</div>
Expand Down