hof 22.1.0-timeout-warning-sign-in-beta.2 → 22.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/automate-publish.yml +4 -4
- package/.github/workflows/automate-tag.yml +16 -16
- package/CHANGELOG.md +20 -20
- package/README.md +44 -7
- package/components/emailer/transports/smtp.js +1 -1
- package/components/session-timeout-warning/index.js +11 -0
- package/config/hof-defaults.js +2 -0
- package/controller/controller.js +4 -0
- package/frontend/template-partials/translations/src/en/save-and-exit.json +4 -0
- package/frontend/template-partials/views/partials/head.html +4 -1
- package/frontend/template-partials/views/partials/session-timeout-warning.html +7 -6
- package/frontend/template-partials/views/save-and-exit.html +1 -3
- package/index.js +3 -0
- package/lib/deindex.js +18 -0
- package/lib/router.js +2 -0
- package/package.json +1 -2
- package/{pull-request-template.md → pull_request_template.md} +1 -1
- package/sandbox/apps/sandbox/translations/src/en/pages.json +2 -2
- package/sandbox/apps/sandbox/views/save-and-exit.html +19 -0
- package/wizard/index.js +2 -0
- package/.nyc_output/9376679c-295d-4483-8c62-60e08528311a.json +0 -1
- package/.nyc_output/processinfo/9376679c-295d-4483-8c62-60e08528311a.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/frontend/govuk-template/govuk_template_generated.html +0 -102
- package/sandbox/.env +0 -3
- package/sandbox/apps/sandbox/translations/en/default.json +0 -239
- package/sandbox/public/css/app.css +0 -9552
- package/sandbox/public/images/icons/icon-caret-left.png +0 -0
- package/sandbox/public/images/icons/icon-complete.png +0 -0
- package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
- package/sandbox/public/js/bundle.js +0 -47603
|
@@ -8,15 +8,15 @@ on:
|
|
|
8
8
|
- completed
|
|
9
9
|
jobs:
|
|
10
10
|
auto-publish:
|
|
11
|
-
runs-on: ubuntu-
|
|
11
|
+
runs-on: ubuntu-22.04
|
|
12
12
|
if: startsWith(github.ref, 'refs/heads/master')
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
15
|
with:
|
|
16
16
|
fetch-depth: 0
|
|
17
|
-
- uses: actions/setup-node@
|
|
17
|
+
- uses: actions/setup-node@v4
|
|
18
18
|
with:
|
|
19
|
-
node-version:
|
|
19
|
+
node-version: 20
|
|
20
20
|
registry-url: https://registry.npmjs.org/
|
|
21
21
|
- name: 'Get Previous tag'
|
|
22
22
|
id: previoustag
|
|
@@ -4,14 +4,14 @@ name: Automate_Tag
|
|
|
4
4
|
on: [push]
|
|
5
5
|
jobs:
|
|
6
6
|
test:
|
|
7
|
-
runs-on: ubuntu-
|
|
7
|
+
runs-on: ubuntu-22.04
|
|
8
8
|
strategy:
|
|
9
9
|
matrix:
|
|
10
|
-
node-version: [
|
|
10
|
+
node-version: [20.x]
|
|
11
11
|
redis-version: [4, 5, 6]
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
14
|
-
- uses: actions/setup-node@
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-node@v4
|
|
15
15
|
with:
|
|
16
16
|
node-version: ${{ matrix.node-version }}
|
|
17
17
|
- name: Start Redis
|
|
@@ -25,16 +25,16 @@ jobs:
|
|
|
25
25
|
|
|
26
26
|
auto-tag-patch:
|
|
27
27
|
needs: test
|
|
28
|
-
runs-on: ubuntu-
|
|
28
|
+
runs-on: ubuntu-22.04
|
|
29
29
|
if: |
|
|
30
30
|
startsWith(github.ref, 'refs/heads/master') &&
|
|
31
31
|
!contains(github.event.head_commit.message, '[MAJOR]') &&
|
|
32
32
|
!contains(github.event.head_commit.message, '[MINOR]')
|
|
33
33
|
steps:
|
|
34
|
-
- uses: actions/checkout@
|
|
35
|
-
- uses: actions/setup-node@
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: actions/setup-node@v4
|
|
36
36
|
with:
|
|
37
|
-
node-version:
|
|
37
|
+
node-version: 20
|
|
38
38
|
registry-url: https://registry.npmjs.org/
|
|
39
39
|
- run: |
|
|
40
40
|
git config --local user.email "$(git log --format='%ae' HEAD^!)"
|
|
@@ -43,16 +43,16 @@ jobs:
|
|
|
43
43
|
|
|
44
44
|
auto-tag-minor:
|
|
45
45
|
needs: test
|
|
46
|
-
runs-on: ubuntu-
|
|
46
|
+
runs-on: ubuntu-22.04
|
|
47
47
|
if: |
|
|
48
48
|
startsWith(github.ref, 'refs/heads/master') &&
|
|
49
49
|
!contains(github.event.head_commit.message, '[MAJOR]') &&
|
|
50
50
|
contains(github.event.head_commit.message, '[MINOR]')
|
|
51
51
|
steps:
|
|
52
|
-
- uses: actions/checkout@
|
|
53
|
-
- uses: actions/setup-node@
|
|
52
|
+
- uses: actions/checkout@v4
|
|
53
|
+
- uses: actions/setup-node@v4
|
|
54
54
|
with:
|
|
55
|
-
node-version:
|
|
55
|
+
node-version: 20
|
|
56
56
|
registry-url: https://registry.npmjs.org/
|
|
57
57
|
- run: |
|
|
58
58
|
git config --local user.email "$(git log --format='%ae' HEAD^!)"
|
|
@@ -61,16 +61,16 @@ jobs:
|
|
|
61
61
|
|
|
62
62
|
auto-tag-major:
|
|
63
63
|
needs: test
|
|
64
|
-
runs-on: ubuntu-
|
|
64
|
+
runs-on: ubuntu-22.04
|
|
65
65
|
if: |
|
|
66
66
|
startsWith(github.ref, 'refs/heads/master') &&
|
|
67
67
|
contains(github.event.head_commit.message, '[MAJOR]') &&
|
|
68
68
|
!contains(github.event.head_commit.message, '[MINOR]')
|
|
69
69
|
steps:
|
|
70
|
-
- uses: actions/checkout@
|
|
71
|
-
- uses: actions/setup-node@
|
|
70
|
+
- uses: actions/checkout@v4
|
|
71
|
+
- uses: actions/setup-node@v4
|
|
72
72
|
with:
|
|
73
|
-
node-version:
|
|
73
|
+
node-version: 20
|
|
74
74
|
registry-url: https://registry.npmjs.org/
|
|
75
75
|
- run: |
|
|
76
76
|
git config --local user.email "$(git log --format='%ae' HEAD^!)"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
##
|
|
2
|
-
*
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Fixes accessibility issues
|
|
7
|
-
* Sandbox area for testing hof changes
|
|
8
|
-
* Updates patch and minor dependency versions
|
|
1
|
+
## 2025-01-24, Version 22.1.0 (Stable), @sulthan-ahmed
|
|
2
|
+
* ⛓️💥 **BREAKING CHANGE** : removed `nodemailer-smtp-transport` replaced with `nodemailer`.
|
|
3
|
+
- The nodemailer-smtp-transport package has been removed due to a critical vulnerability, and its functionality has been consolidated under nodemailer.
|
|
4
|
+
- 👊 Impact : Any functions or configurations relying on nodemailer-smtp-transport must be updated to use nodemailer.
|
|
5
|
+
- 🎬 Action: Rewrite code to utilize nodemailer as the replacement, ensuring compatibility and security.
|
|
9
6
|
|
|
10
|
-
##
|
|
7
|
+
## 2025-01-17, Version 22.0.0 (Stable), @Rhodine-orleans-lindsay
|
|
11
8
|
* Adds session timeout warning
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
- user can stay on page or exit form
|
|
10
|
+
- adds exit html
|
|
11
|
+
- user can stay signed in or save and exit the form if the form is a save and exit form
|
|
12
|
+
- adds default save-and-exit html
|
|
13
|
+
- updates confirmation html to a static page
|
|
14
|
+
- allows for customisation of session timeout warning dialog content, exit and save-and-exit page content, and exit and save-and-exit steps
|
|
15
|
+
- Potential **_breaking change_**: Static pages should use the `{{<layout}}...{{/layout}}` tags instead of the `{{<partials-page}}...{{/partials-page}}` tags if the timeout warning should not be displayed.
|
|
16
16
|
* Fixes accessibility issues
|
|
17
17
|
* Sandbox area for testing hof changes
|
|
18
18
|
* Updates patch and minor dependency versions
|
|
@@ -20,23 +20,23 @@
|
|
|
20
20
|
## 2024-07-22, Version 21.0.0 (Stable), @Rhodine-orleans-lindsay
|
|
21
21
|
* Replaces deprecated request module with axios
|
|
22
22
|
- refactors the hof model and apis to use axios instead of request
|
|
23
|
-
*
|
|
23
|
+
* Updates patch and minor dependency versions
|
|
24
24
|
|
|
25
25
|
## 2024-04-24, Version 20.5.0 (Stable), @mislam987
|
|
26
26
|
* Add hint property to checkboxes to align with govuk design guidelines
|
|
27
27
|
|
|
28
28
|
## 2024-02-29, Version 20.4.0 (Stable), @sulthan-ahmed
|
|
29
29
|
* Update version of govuk-frontend to 3.15
|
|
30
|
-
- this adds the new crown for the King
|
|
31
|
-
- this supports a lot of changes from the govuk design system
|
|
30
|
+
- this adds the new crown for the King
|
|
31
|
+
- this supports a lot of changes from the govuk design system
|
|
32
32
|
* Adds support for Google tag manager
|
|
33
33
|
* Fixes accessibility issues
|
|
34
34
|
* Sandbox area for testing hof changes
|
|
35
35
|
* Updates patch and minor versions including
|
|
36
|
-
- libphonenumber to 1.9.44
|
|
37
|
-
- nodemailer to 6.9.9
|
|
38
|
-
- ip to 1.1.9
|
|
39
|
-
- es5-ext to 0.10.63
|
|
36
|
+
- libphonenumber to 1.9.44
|
|
37
|
+
- nodemailer to 6.9.9
|
|
38
|
+
- ip to 1.1.9
|
|
39
|
+
- es5-ext to 0.10.63
|
|
40
40
|
|
|
41
41
|
## 2020-06-02, Version 16.0.0 (Stable), @andymoody
|
|
42
42
|
* Update version of helmet to 3.22.0
|
package/README.md
CHANGED
|
@@ -1205,7 +1205,7 @@ The following transport options are available:
|
|
|
1205
1205
|
|
|
1206
1206
|
#### `smtp`
|
|
1207
1207
|
|
|
1208
|
-
[nodemailer
|
|
1208
|
+
[nodemailer](https://github.com/nodemailer/nodemailer)
|
|
1209
1209
|
|
|
1210
1210
|
##### Options
|
|
1211
1211
|
|
|
@@ -1261,7 +1261,7 @@ This feature allows you to customise the content related to the session timeout
|
|
|
1261
1261
|
|
|
1262
1262
|
### Usage
|
|
1263
1263
|
|
|
1264
|
-
To enable and
|
|
1264
|
+
To enable and customise the session timeout behavior, you need to set the component in your project's `hof.settings.json` file:
|
|
1265
1265
|
```js
|
|
1266
1266
|
"behaviours": [
|
|
1267
1267
|
"hof/components/session-timeout-warning"
|
|
@@ -1274,12 +1274,13 @@ By default, the framework uses the standard content provided by HOF. If you wish
|
|
|
1274
1274
|
behaviours: [
|
|
1275
1275
|
require('../').components.sessionTimeoutWarning
|
|
1276
1276
|
],
|
|
1277
|
-
sessionTimeoutWarningContent: true,
|
|
1278
|
-
exitFormContent: true
|
|
1277
|
+
sessionTimeoutWarningContent: true, // allows you to customise the content in the session timeout dialog box
|
|
1278
|
+
exitFormContent: true // allows you to customise the content on the exit page
|
|
1279
|
+
saveExitFormContent: true // allows you to customise the content on the save-and-exit page
|
|
1279
1280
|
```
|
|
1280
1281
|
|
|
1281
1282
|
### Customising content in `pages.json`
|
|
1282
|
-
Once the variables are set, you can
|
|
1283
|
+
Once the variables are set, you can customise the session timeout warning and exit messages in your project's pages.json:
|
|
1283
1284
|
|
|
1284
1285
|
```json
|
|
1285
1286
|
"exit": {
|
|
@@ -1291,10 +1292,13 @@ Once the variables are set, you can customize the session timeout warning and ex
|
|
|
1291
1292
|
"timeout-continue-button": "Stay on this page",
|
|
1292
1293
|
"dialog-exit-link": "Exit this form"
|
|
1293
1294
|
}
|
|
1295
|
+
"save-and-exit": {
|
|
1296
|
+
"message": "Any answers you saved have not been affected. You can sign back in to your application at any time by returning to the start page."
|
|
1297
|
+
},
|
|
1294
1298
|
```
|
|
1295
1299
|
|
|
1296
|
-
### Editing content on the Exit Page Header and Title
|
|
1297
|
-
To edit the exit
|
|
1300
|
+
### Editing content on the Exit and Save-and-exit Page Header and Title
|
|
1301
|
+
To edit the exit or save-and-exit pages' header and title, create an `exit.json` or `save-and-exit.json` file in your project and set the desired content:
|
|
1298
1302
|
```json
|
|
1299
1303
|
{
|
|
1300
1304
|
"header": "You have left this form",
|
|
@@ -1302,6 +1306,39 @@ To edit the exit page's header and title, create an `exit.json` file in your pro
|
|
|
1302
1306
|
}
|
|
1303
1307
|
```
|
|
1304
1308
|
|
|
1309
|
+
### Customising exit and save-and-exit steps
|
|
1310
|
+
You can customise the `exit` and `save-and-exit` steps by setting the `exitStep` or `saveAndExitStep` properties in the `apps/<app_name>/index.js` to the desired path name:
|
|
1311
|
+
|
|
1312
|
+
```js
|
|
1313
|
+
// customising exit step name
|
|
1314
|
+
module.exports = {
|
|
1315
|
+
name: 'sandbox',
|
|
1316
|
+
exitStep: '/leave',
|
|
1317
|
+
steps: {
|
|
1318
|
+
...
|
|
1319
|
+
'/leave': {
|
|
1320
|
+
template: 'exit'
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
...
|
|
1324
|
+
}
|
|
1325
|
+
```
|
|
1326
|
+
|
|
1327
|
+
```js
|
|
1328
|
+
// customising save-and-exit step name
|
|
1329
|
+
module.exports = {
|
|
1330
|
+
name: 'sandbox',
|
|
1331
|
+
saveAndExitStep: '/sign-out',
|
|
1332
|
+
steps: {
|
|
1333
|
+
...
|
|
1334
|
+
'/sign-out': {
|
|
1335
|
+
template: 'save-and-exit'
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
...
|
|
1339
|
+
}
|
|
1340
|
+
```
|
|
1341
|
+
|
|
1305
1342
|
# UTILITIES
|
|
1306
1343
|
|
|
1307
1344
|
# Autofill Utility
|
|
@@ -51,6 +51,17 @@ module.exports = superclass => class extends superclass {
|
|
|
51
51
|
superLocals.message = req.translate('exit.message');
|
|
52
52
|
return superLocals;
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
// set the content on /save-and-exit page
|
|
56
|
+
if (req.form.options.route === '/save-and-exit' && config.saveExitFormContent === true) {
|
|
57
|
+
superLocals.saveExitFormContent = true;
|
|
58
|
+
return superLocals;
|
|
59
|
+
} else if (req.form.options.route === '/save-and-exit' && config.saveExitFormContent === false) {
|
|
60
|
+
superLocals.header = req.translate('save-and-exit.header');
|
|
61
|
+
superLocals.title = req.translate('save-and-exit.title');
|
|
62
|
+
superLocals.message = req.translate('save-and-exit.message');
|
|
63
|
+
return superLocals;
|
|
64
|
+
}
|
|
54
65
|
return superLocals;
|
|
55
66
|
}
|
|
56
67
|
};
|
package/config/hof-defaults.js
CHANGED
|
@@ -16,6 +16,7 @@ const defaults = {
|
|
|
16
16
|
getAccessibility: false,
|
|
17
17
|
sessionTimeoutWarningContent: false,
|
|
18
18
|
exitFormContent: false,
|
|
19
|
+
saveExitFormContent: false,
|
|
19
20
|
viewEngine: 'html',
|
|
20
21
|
protocol: process.env.PROTOCOL || 'http',
|
|
21
22
|
noCache: process.env.NO_CACHE || false,
|
|
@@ -32,6 +33,7 @@ const defaults = {
|
|
|
32
33
|
return convertPage(page);
|
|
33
34
|
}
|
|
34
35
|
},
|
|
36
|
+
deIndexForm: process.env.DEINDEX_FORM || 'false',
|
|
35
37
|
gaCrossDomainTrackingTagId: process.env.GDS_CROSS_DOMAIN_GA_TAG,
|
|
36
38
|
loglevel: process.env.LOG_LEVEL || 'info',
|
|
37
39
|
ignoreMiddlewareLogs: ['/healthz'],
|
package/controller/controller.js
CHANGED
|
@@ -109,10 +109,14 @@ module.exports = class Controller extends BaseController {
|
|
|
109
109
|
// only include fields that aren't dependents to mitigate duplicate fields on the page
|
|
110
110
|
fields = fields.filter(field => !req.form.options.fields[field.key].dependent);
|
|
111
111
|
|
|
112
|
+
const exitStep = req.form.options.exitStep || '/exit';
|
|
113
|
+
const saveAndExitStep = req.form.options.saveAndExitStep || '/save-and-exit';
|
|
112
114
|
return _.extend({}, locals, {
|
|
113
115
|
fields,
|
|
114
116
|
route,
|
|
115
117
|
baseUrl: req.baseUrl,
|
|
118
|
+
exitStep,
|
|
119
|
+
saveAndExitStep,
|
|
116
120
|
skipToMain: this.getFirstFormItem(req.form.options.fields),
|
|
117
121
|
title: this.getTitle(route, lookup, req.form.options.fields, res.locals),
|
|
118
122
|
journeyHeaderURL: this.getJourneyHeaderURL(req.baseUrl),
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
{{/cookiesAccepted}}
|
|
22
22
|
{{/gtmTagId}}
|
|
23
23
|
|
|
24
|
+
{{#deIndex}}
|
|
25
|
+
<meta name="robots" content="noindex">
|
|
26
|
+
{{/deIndex}}
|
|
24
27
|
<meta name="format-detection" content="telephone=no">
|
|
25
28
|
<noscript>
|
|
26
|
-
<meta http-equiv="refresh" content="{{sessionTimeOut}};url='/session-timeout'"/>
|
|
29
|
+
<meta http-equiv="refresh" content="{{sessionTimeOut}};url='{{baseUrl}}/session-timeout'"/>
|
|
27
30
|
</noscript>
|
|
28
31
|
<link rel="stylesheet" href="{{assetPath}}/css/app.css">
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
data-url-redirect="/session-timeout" class="modal-dialog dialog" role="dialog"
|
|
9
9
|
aria-live="polite" aria-labelledby="dialog-title" aria-describedby="at-timer">
|
|
10
10
|
<div class="modal-dialog__inner">
|
|
11
|
-
|
|
11
|
+
{{^showSaveAndExit}}
|
|
12
12
|
<h2 id="dialog-title" class="govuk-heading-l">
|
|
13
13
|
{{#dialogTitle}}{{#t}}pages.session-timeout-warning.dialog-title{{/t}}{{/dialogTitle}}{{^dialogTitle}}Your page will time out soon{{/dialogTitle}}
|
|
14
14
|
</h2>
|
|
@@ -19,9 +19,9 @@ data-url-redirect="/session-timeout" class="modal-dialog dialog" role="dialog"
|
|
|
19
19
|
<p class="dialog-text visually-hidden">{{#dialogText}}{{#t}}pages.session-timeout-warning.dialog-text{{/t}}{{/dialogText}}{{^dialogText}}If that happens, your progress will not be saved.{{/dialogText}}</p>
|
|
20
20
|
</div>
|
|
21
21
|
<button class="govuk-button dialog-button js-dialog-close" id="timeout-continue-button" data-module="govuk-button">{{#timeoutContinueButton}}{{#t}}pages.session-timeout-warning.timeout-continue-button{{/t}}{{/timeoutContinueButton}}{{^timeoutContinueButton}}Stay on this page{{/timeoutContinueButton}}</button>
|
|
22
|
-
<a href="
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
<a href="{{baseUrl}}{{exitStep}}" class="govuk-link dialog-exit-link" role="button">{{#dialogExitLink}}{{#t}}pages.session-timeout-warning.dialog-exit-link{{/t}}{{/dialogExitLink}}{{^dialogExitLink}}Exit this form{{/dialogExitLink}}</a>
|
|
23
|
+
{{/showSaveAndExit}}
|
|
24
|
+
{{#showSaveAndExit}}
|
|
25
25
|
<h2 id="dialog-title" class="govuk-heading-l">
|
|
26
26
|
{{#dialogTitle}}{{#t}}pages.session-timeout-warning.dialog-title{{/t}}{{/dialogTitle}}{{^dialogTitle}}You will be signed out soon{{/dialogTitle}}
|
|
27
27
|
</h2>
|
|
@@ -29,9 +29,10 @@ data-url-redirect="/session-timeout" class="modal-dialog dialog" role="dialog"
|
|
|
29
29
|
<div id="timer" class="timer" aria-hidden="true" aria-relevant="additions"></div>
|
|
30
30
|
<div id="at-timer" class="at-timer govuk-visually-hidden" role="status"></div>
|
|
31
31
|
<p class="dialog-text-prefix visually-hidden">To protect your information, you will be signed out in </p>
|
|
32
|
+
<p class="dialog-text visually-hidden">{{#dialogText}}{{#t}}pages.session-timeout-warning.dialog-text{{/t}}{{/dialogText}}{{^dialogText}}Any answers you have saved will not be affected, but your progress on this page will not be saved.{{/dialogText}}</p>
|
|
32
33
|
</div>
|
|
33
34
|
<button class="govuk-button dialog-button js-dialog-close" id="timeout-continue-button" data-module="govuk-button">{{#timeoutContinueButton}}{{#t}}pages.session-timeout-warning.timeout-continue-button{{/t}}{{/timeoutContinueButton}}{{^timeoutContinueButton}}Stay signed in{{/timeoutContinueButton}}</button>
|
|
34
|
-
<a href="{{baseUrl}}
|
|
35
|
-
|
|
35
|
+
<a href="{{baseUrl}}{{saveAndExitStep}}" class="govuk-link dialog-exit-link" role="button">{{#dialogExitLink}}{{#t}}pages.session-timeout-warning.dialog-exit-link{{/t}}{{/dialogExitLink}}{{^dialogExitLink}}Sign out{{/dialogExitLink}}</a>
|
|
36
|
+
{{/showSaveAndExit}}
|
|
36
37
|
</div>
|
|
37
38
|
</dialog>
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
{{/header}}
|
|
13
13
|
|
|
14
14
|
{{$content}}
|
|
15
|
-
|
|
16
|
-
<p>{{#t}}pages.save-and-exit.paragraph-2{{/t}}</p>
|
|
17
|
-
<p>{{#t}}pages.save-and-exit.paragraph-3{{/t}} <a href="/" class="govuk-link">start page.</a></p>
|
|
15
|
+
<p>{{#saveExitFormContent}}{{#t}}pages.save-and-exit.message{{/t}}{{/saveExitFormContent}}{{^saveExitFormContent}}{{{message}}}{{/saveExitFormContent}}</p>
|
|
18
16
|
{{/content}}
|
|
19
17
|
{{/layout}}
|
package/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const router = require('./lib/router');
|
|
|
14
14
|
const health = require('./lib/health');
|
|
15
15
|
const serveStatic = require('./lib/serve-static');
|
|
16
16
|
const gaTagSetup = require('./lib/ga-tag');
|
|
17
|
+
const deIndexer = require('./lib/deindex');
|
|
17
18
|
const sessionStore = require('./lib/sessions');
|
|
18
19
|
const settings = require('./lib/settings');
|
|
19
20
|
const defaults = require('./config/hof-defaults');
|
|
@@ -153,6 +154,7 @@ function bootstrap(options) {
|
|
|
153
154
|
res.locals.sessionTimeOutWarning = config.sessionTimeOutWarning;
|
|
154
155
|
res.locals.sessionTimeoutWarningContent = config.sessionTimeoutWarningContent;
|
|
155
156
|
res.locals.exitFormContent = config.exitFormContent;
|
|
157
|
+
res.locals.saveExitFormContent = config.saveExitFormContent;
|
|
156
158
|
next();
|
|
157
159
|
});
|
|
158
160
|
|
|
@@ -204,6 +206,7 @@ function bootstrap(options) {
|
|
|
204
206
|
serveStatic(app, config);
|
|
205
207
|
settings(app, config);
|
|
206
208
|
gaTagSetup(app, config);
|
|
209
|
+
deIndexer(app, config);
|
|
207
210
|
|
|
208
211
|
const sessions = sessionStore(app, config);
|
|
209
212
|
app.use('/healthz', health(sessions));
|
package/lib/deindex.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = (app, config) => {
|
|
4
|
+
// Ensure the value of deIndex is evaluated as a boolean regardless of if single quotes are used
|
|
5
|
+
// to have the expected conditional behaviour in the Mustache template
|
|
6
|
+
const deIndex = (config.deIndexForm === 'true' || config.deIndexForm === true);
|
|
7
|
+
|
|
8
|
+
app.use((req, res, next) => {
|
|
9
|
+
// Preparing common res.locals properties
|
|
10
|
+
const properties = {
|
|
11
|
+
deIndex: deIndex
|
|
12
|
+
};
|
|
13
|
+
res.locals = Object.assign(res.locals, properties);
|
|
14
|
+
next();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return app;
|
|
18
|
+
};
|
package/lib/router.js
CHANGED
|
@@ -30,6 +30,8 @@ function getWizardConfig(config) {
|
|
|
30
30
|
// whitelist properties from the route's config that should be passed into the form wizard
|
|
31
31
|
const props = [
|
|
32
32
|
'confirmStep',
|
|
33
|
+
'exitStep',
|
|
34
|
+
'saveAndExitStep',
|
|
33
35
|
'params'
|
|
34
36
|
];
|
|
35
37
|
Object.assign(wizardConfig, _.pick(config.route, props));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hof",
|
|
3
3
|
"description": "A bootstrap for HOF projects",
|
|
4
|
-
"version": "22.1.
|
|
4
|
+
"version": "22.1.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": "HomeOffice",
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
"mustache": "^4.2.0",
|
|
80
80
|
"nodemailer": "^6.6.3",
|
|
81
81
|
"nodemailer-ses-transport": "^1.5.1",
|
|
82
|
-
"nodemailer-smtp-transport": "^2.7.4",
|
|
83
82
|
"nodemailer-stub-transport": "^1.1.0",
|
|
84
83
|
"notifications-node-client": "^8.2.0",
|
|
85
84
|
"redis": "^3.1.2",
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
- [ ] I have created a JIRA number for my commit
|
|
13
13
|
- [ ] I have followed the chris beams method for my commit https://cbea.ms/git-commit/
|
|
14
14
|
here is an [example commit](https://github.com/UKHomeOfficeForms/hof/commit/810959f391187c7c4af6db262bcd143b50093a6e)
|
|
15
|
-
- [ ] Ensure
|
|
15
|
+
- [ ] Ensure workflow jobs are passing especially tests
|
|
16
16
|
- [ ] I will squash the commits before merging
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
},
|
|
66
66
|
"save-and-exit": {
|
|
67
67
|
"header": "You have been signed out",
|
|
68
|
-
"paragraph-1": "Your form doesn
|
|
68
|
+
"paragraph-1": "Your form doesn't appear to have been worked on for 30 minutes so we closed it for security.",
|
|
69
69
|
"paragraph-2": "Any answers you saved have not been affected.",
|
|
70
|
-
"paragraph-3": "You can sign back in to your application at any time by returning to the"
|
|
70
|
+
"paragraph-3": "You can sign back in to your application at any time by returning to the <a href='/' class='govuk-link'>start page</a>."
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{<layout}}
|
|
2
|
+
{{$journeyHeader}}
|
|
3
|
+
{{#t}}journey.header{{/t}}
|
|
4
|
+
{{/journeyHeader}}
|
|
5
|
+
|
|
6
|
+
{{$propositionHeader}}
|
|
7
|
+
{{> partials-navigation}}
|
|
8
|
+
{{/propositionHeader}}
|
|
9
|
+
|
|
10
|
+
{{$header}}
|
|
11
|
+
{{header}}
|
|
12
|
+
{{/header}}
|
|
13
|
+
|
|
14
|
+
{{$content}}
|
|
15
|
+
<p>{{#t}}pages.save-and-exit.paragraph-1{{/t}}</p>
|
|
16
|
+
<p>{{#t}}pages.save-and-exit.paragraph-2{{/t}}</p>
|
|
17
|
+
<p>{{#t}}pages.save-and-exit.paragraph-3{{/t}}</p>
|
|
18
|
+
{{/content}}
|
|
19
|
+
{{/layout}}
|
package/wizard/index.js
CHANGED
|
@@ -67,6 +67,8 @@ const Wizard = (steps, fields, setts) => {
|
|
|
67
67
|
options.route = route;
|
|
68
68
|
options.appConfig = settings.appConfig;
|
|
69
69
|
options.confirmStep = settings.confirmStep;
|
|
70
|
+
options.exitStep = settings.exitStep;
|
|
71
|
+
options.saveAndExitStep = settings.saveAndExitStep;
|
|
70
72
|
options.clearSession = options.clearSession || false;
|
|
71
73
|
options.fieldsConfig = _.cloneDeep(fields);
|
|
72
74
|
options.sanitiseInputs = settings.sanitiseInputs;
|