hof 22.9.0-fix-timeout-back-button-bug-beta → 22.9.0-fix-timeout-back-button-bug-beta.3

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.
@@ -1,7 +1,7 @@
1
1
  {{<error}}
2
2
  {{$content}}
3
- <h1 class="govuk-heading-l">{{#t}}errors.session.title{{/t}}</h1>
4
- <h2 class="govuk-heading-m">{{#t}}errors.session.message{{/t}}</h2>
3
+ <h1 class="govuk-heading-l">{{{content.title}}}</h1>
4
+ <h2 class="govuk-heading-m">{{{content.message}}}</h2>
5
5
  <a href="{{startLink}}" class="govuk-button" role="button">{{#t}}buttons.start-again{{/t}}</a>
6
6
  {{/content}}
7
7
  {{/error}}
package/index.js CHANGED
@@ -249,6 +249,22 @@ function bootstrap(options) {
249
249
  return next();
250
250
  });
251
251
  }
252
+
253
+ app.get('/session-timeout', (req, res, next) => {
254
+ const referer = req.get('referer');
255
+ console.log(referer);
256
+ console.log(req.session.exists);
257
+ if (req.cookies['hof-wizard-sc'] && req.session.exists !== true) {
258
+ const err = new Error('Session expired');
259
+ err.code = 'SESSION_TIMEOUT';
260
+ return next(err);
261
+ }
262
+ const err = new Error('Not Found');
263
+ err.status = 404;
264
+ const locals = Object.assign({}, req.translate('errors'));
265
+ return res.status(404).render('404', locals['404']);
266
+ });
267
+
252
268
  if (config.getAccessibility === true) {
253
269
  deprecate(
254
270
  '`getAccessibility` option is deprecated and may be removed in future versions.',
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.9.0-fix-timeout-back-button-bug-beta",
4
+ "version": "22.9.0-fix-timeout-back-button-bug-beta.3",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
package/sandbox/.env CHANGED
@@ -1,3 +1,4 @@
1
1
  SERVICE_UNAVAILABLE=false
2
2
  SESSION_TTL=10
3
3
  SESSION_TIMEOUT_WARNING=5
4
+
@@ -92,7 +92,6 @@ module.exports = {
92
92
  ],
93
93
  next: '/confirm'
94
94
  },
95
- '/session-timeout': {},
96
95
  '/exit': {},
97
96
  '/save-and-exit': {}
98
97
  }