Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BRP Release 9.0 #770

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5708e61
Added max property and used in truncate template
MCrawleyHomeOffice May 11, 2022
6ce458e
Fixed unit tests
MCrawleyHomeOffice May 11, 2022
a8cdc4e
Fixed linting issues
MCrawleyHomeOffice May 11, 2022
af007cb
Expanded truncation logic to display correct errors for all truncated…
MCrawleyHomeOffice May 16, 2022
ba7baaf
Addressed various issues as per conversation with business contact
MCrawleyHomeOffice May 24, 2022
0bba65e
Fixed linting issues
MCrawleyHomeOffice May 24, 2022
13da713
Fixed unit tests and added extra info on caseworker email
MCrawleyHomeOffice May 24, 2022
e115640
Modified email templates
MCrawleyHomeOffice May 25, 2022
b4a37b2
Corrected template
MCrawleyHomeOffice May 25, 2022
33924cb
Added acceptance tests
MCrawleyHomeOffice May 30, 2022
e0387d7
Fixed minor bug with non-truncated values on confirm page
MCrawleyHomeOffice Jun 15, 2022
34781b8
Fixed linting issues
MCrawleyHomeOffice Jun 15, 2022
383eff2
BRP-71 Fixed acceptance tests
MCrawleyHomeOffice Aug 30, 2022
f62d48e
Corrected a few minor merge issues
MCrawleyHomeOffice Jan 23, 2023
4a4fe0f
BRP-71 - Bumped hof version
MCrawleyHomeOffice Jan 25, 2023
ccba57b
Added passport number to LostStolen Personal Details page
MCrawleyHomeOffice Jan 30, 2023
b10caa5
BRP-105 Added passport no to email template
MCrawleyHomeOffice Jan 30, 2023
6dd1ac2
BRP-105 Adjusted new passport field to be mandatory
MCrawleyHomeOffice Jan 30, 2023
793ca6f
BRP-105 Added translations for passport number field
MCrawleyHomeOffice Jan 30, 2023
5058f42
BRP-105 Added acceptance test
MCrawleyHomeOffice Jan 30, 2023
b8652df
BRP-105 Bumped HOF to fix CVEs
MCrawleyHomeOffice Jan 30, 2023
670cb90
BRP-105 Added missing notUrl translation
MCrawleyHomeOffice Feb 7, 2023
a99b277
Merge branch 'BRP-71-Birth-Place-Truncation'
shamiluwais May 17, 2023
dbbbf50
Create release branch and merge in this branch
shamiluwais May 17, 2023
0132b5d
updated node and sonar-scanner
shamiluwais Jun 5, 2023
8cfcf40
update snyk
shamiluwais Jun 5, 2023
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
14 changes: 7 additions & 7 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ trigger:

linting: &linting
pull: if-not-exists
image: node:14
image: node:18
environment:
NOTIFY_KEY: USE_MOCK
commands:
- yarn run test:lint

unit_tests: &unit_tests
pull: if-not-exists
image: node:14
image: node:18
environment:
NOTIFY_KEY: USE_MOCK
commands:
- yarn run test:unit

sonar_scanner: &sonar_scanner
pull: if-not-exists
image: quay.io/ukhomeofficedigital/sonar-scanner-node:549b75f593f28da1c4a0a6f79877ec69d3b21037
image: quay.io/ukhomeofficedigital/sonar-scanner-nodejs:latest
commands:
- sonar-scanner -Dproject.settings=./sonar-project.properties

Expand Down Expand Up @@ -70,7 +70,7 @@ steps:

- name: setup_deploy
pull: if-not-exists
image: node:14
image: node:18
environment:
NOTIFY_KEY: USE_MOCK
commands:
Expand Down Expand Up @@ -150,7 +150,7 @@ steps:

- name: setup_branch
pull: if-not-exists
image: node:14
image: node:18
environment:
NOTIFY_KEY: USE_MOCK
commands:
Expand Down Expand Up @@ -205,7 +205,7 @@ steps:
# Snyk & Anchore security scans which run after branch deployment to prevent blocking of PR UAT tests
- name: snyk_scan
pull: if-not-exists
image: node:14
image: node:18
environment:
SNYK_TOKEN:
from_secret: snyk_token
Expand Down Expand Up @@ -391,7 +391,7 @@ steps:

- name: cron_snyk_scan
pull: if-not-exists
image: node:14
image: node:18
environment:
SNYK_TOKEN:
from_secret: snyk_token
Expand Down
6 changes: 5 additions & 1 deletion .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ ignore:
SNYK-JS-REQUEST-3361831:
- hof > request:
reason: No current upgrade available
expires: '2023-05-05T10:44:27.223Z'
expires: '2024-05-05T10:44:27.223Z'
SNYK-JS-XML2JS-5414874:
- '*':
reason: No current upgrade available
expires: '2024-05-05T10:44:27.223Z'
patch: {}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM node:14-alpine@sha256:5c33bc6f021453ae2e393e6e20650a4df0a4737b1882d389f17069dc1933fdc5
FROM node:18-alpine@sha256:2322b1bb3917b313f2e9308395aa5c39d51b91cc92a5d4d5be6d0451fcfb4d24

USER root

# Update packages as a result of Anchore security vulnerability checks
RUN apk update && \
apk add --upgrade gnutls binutils nodejs nodejs-npm apk-tools libjpeg-turbo libcurl libx11 libxml2
apk add --upgrade gnutls binutils nodejs nodejs npm apk-tools libjpeg-turbo libcurl libx11 libxml2

# Setup nodejs group & nodejs user
RUN addgroup --system nodejs --gid 998 && \
Expand Down
19 changes: 18 additions & 1 deletion apps/correct-mistakes/behaviours/about-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
'use strict';

const _ = require('underscore');
const fields = require('../translations/src/en/fields.json');
const pages = require('../translations/src/en/pages.json');

const truncateConfigs = [
{
id: 'first-name-error',
prettyName: fields['first-name-error-checkbox'].label,
translations: pages['exit-truncated']['first-name'],
max: 30
},
{
id: 'last-name-error',
prettyName: fields['last-name-error-checkbox'].label,
translations: pages['exit-truncated']['last-name'],
max: 30
},
{
id: 'birth-place-error',
prettyName: fields['birth-place-error-checkbox'].label,
translations: pages['exit-truncated']['birth-place'],
max: 16
}
];
Expand All @@ -34,7 +42,7 @@ function getTruncatedItems(req) {

truncateConfigs.forEach(config => {
if (isTooLong.call(this, config.id, config.max, req)) {
items.unshift({id: config.id});
items.unshift({id: config.id, max: config.max, prettyName: config.prettyName, translations: config.translations});
}
});
return items;
Expand Down Expand Up @@ -77,6 +85,15 @@ module.exports = superclass => class AboutError extends superclass {

req.sessionModel.unset(diff);

// Regardless of whether we are truncating these fields
// We still need to store them against the appropriate "-truncated" property for our confirm page
truncateConfigs.forEach(config => {
req.sessionModel.set(
config.id + '-truncated',
req.form.values[config.id] ? req.form.values[config.id].slice(0, config.max) : ''
);
});

super.saveValues(req, res, callback);
}

Expand Down
31 changes: 30 additions & 1 deletion apps/correct-mistakes/behaviours/truncated.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ function getTruncatedItems(req) {
}

function truncatedItem(req) {
// Gets the first truncated item that has not yet been shown to the user
// If the value is set, we have warned the user about the truncation
const itemOne = getTruncatedItems(req).filter(item => {
return item.value === undefined;
})[0];
Expand All @@ -20,12 +22,16 @@ function truncatedItem(req) {
pretty: prettyName(itemOne.id),
value: req.form.values[itemOne.id],
length: req.form.values[itemOne.id].length,
slice: req.form.values[itemOne.id].slice(0, 30)
slice: req.form.values[itemOne.id].slice(0, itemOne.max),
max: itemOne.max
};
}
}

function updateTruncatedItems(req) {
// Called once the user confirms if their BRP shows the correctly truncated value
// Will update our session to show that we have informed the user that it should be truncated
// This is so we don't show this truncated item warning again
const values = req.form.values;
let items = getTruncatedItems(req);

Expand Down Expand Up @@ -55,17 +61,40 @@ module.exports = superclass => class Truncated extends superclass {
}

saveValues(req, res, next) {
// We've shown the user a truncated item warning and they've confirmed how it appears on their BRP
updateTruncatedItems(req);

// Have we warned the user about all truncated items?
if (identity(req, true, 'yes') === true) {
// Yes, show the exit-truncation page
// Set our data for the template
const truncatedDetail = getTruncatedItems(req).map(item => {
return {
id: item.id,
prettyName: item.prettyName,
max: item.max,
translations: item.translations
};
});
req.sessionModel.set('truncatedDetail', truncatedDetail);

req.form.options.next = '/exit-truncated';
} else {
// We need to store the truncated value in session so we can display the truncated value on the confirmation page
getTruncatedItems(req).forEach(item => {
req.sessionModel.set(item.id + '-truncated', req.form.historicalValues[item.id].slice(0, item.max));
});
}

// Have we got any truncated items at all?
if (identity(req, false, 'no') === true) {
// No we don't, so continue down the happy path
req.form.options.next = '/uk-address';
}

// Do we still have truncated items that we need to warn the user about?
if (identity(req, false, undefined) === true) {
// Yes we do, loop back to the truncated page
req.form.options.next = '/truncated';
}

Expand Down
9 changes: 6 additions & 3 deletions apps/correct-mistakes/translations/src/en/fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,23 @@
},
"last-name-error": {
"label": "What is your correct family name?",
"title": "This is the first line under 'name' on your BRP."
"title": "This is the first line under 'name' on your BRP.",
"hint": "Due to limitations, we can only print the first 30 characters of your Family Name on your BRP. This is not an error and you will be able to use your BRP."
},
"first-name-error-checkbox": {
"label": "Given name(s)"
},
"first-name-error": {
"label": "What are your correct given name(s)?",
"title": "This is the second line under 'name' on your BRP."
"title": "This is the second line under 'name' on your BRP.",
"hint": "Due to limitations, we can only print the first 30 characters of your Given Name(s) on your BRP. This is not an error and you will be able to use your BRP."
},
"birth-place-error-checkbox": {
"label": "Place of birth"
},
"birth-place-error": {
"label": "What is your correct place of birth?"
"label": "What is your correct place of birth?",
"hint": "Due to limitations, we can only print the first 16 characters of your Place of Birth on your BRP. This is not an error and you will be able to use your BRP."
},
"date-of-birth-error-checkbox": {
"label": "Date of birth"
Expand Down
36 changes: 29 additions & 7 deletions apps/correct-mistakes/translations/src/en/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"check-details-error": {
"header": "Check the details you have provided",
"subheader": "If any information is incorrect, you can change it here.",
"limitations-info": "Due to limitations, we can only print the first 16 characters of your Place of Birth and the first 30 characters of your Given Name(s) and Family Name on your BRP.",
"corrected-details-table": {
"title": "Corrected BRP details"
},
Expand Down Expand Up @@ -97,7 +98,7 @@
}
},
"truncated": {
"header": "Long names on BRPs",
"header": "Long names and places of birth on BRPs",
"paras": {
"one": {
"parts": {
Expand All @@ -109,22 +110,43 @@
"parts": {
"one": "Your",
"two": "has",
"three": "letters. Your BRP can only show a maximum of 30 letters, so it is shortened to this on your BRP:"
"three": "letters. Your BRP can only show a maximum of ",
"four": " letters, so it is shortened to this on your BRP:"
}
},
"three": {
"parts": {
"one": "Is this how it looks on your BRP?"
"one": "Is this how it looks on the BRP you've received?"
}
}
},
"reason-no": "Continue using this service. At the end you can check the spelling of your name, and we shall send you a replacement BRP"
},
"exit-truncated": {
"paras": {
"one": "Due to limitations, we can only print the first 30 characters of your name on your BRP.",
"two": "This is not an error and you will be able to use your BRP.",
"three": "You do not need to do anything else."
"title": "Please note the following information regarding the fields you have selected:",
"first-name": {
"paras": {
"one": "Due to limitations, we can only print the first ",
"two": " characters of your name on your BRP.",
"three": "This is not an error and you will be able to use your BRP.",
"four": "You do not need to do anything else."
}
},
"last-name": {
"paras": {
"one": "Due to limitations, we can only print the first ",
"two": " characters of your name on your BRP.",
"three": "This is not an error and you will be able to use your BRP.",
"four": "You do not need to do anything else."
}
},
"birth-place": {
"paras": {
"one": "Due to limitations, we can only print the first ",
"two": " characters of your birth place on your BRP.",
"three": "This is not an error and you will be able to use your BRP.",
"four": "You do not need to do anything else."
}
}
}
}
11 changes: 6 additions & 5 deletions apps/correct-mistakes/views/confirm.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@

{{$content}}
<p>{{#t}}pages.check-details-error.subheader{{/t}}</p>

<p>{{#t}}pages.check-details-error.limitations-info{{/t}}</p>

{{<partials-form}}

{{$form}}

<h2 class="details-header">{{#t}}pages.check-details-error.corrected-details-table.title{{/t}}</h2>
<table id="check-details" class="table-details">
<tbody>
{{#values.first-name-error}}
<tr>
<td>{{#t}}fields.first-name-error-checkbox.label{{/t}}</td>
<td>
{{values.first-name-error}}
{{values.first-name-error-truncated}}
</td>
<td><a href="about-error/edit#first-name-error" class="button">{{#t}}buttons.change.first-name-error{{/t}}</a></td>
</tr>
Expand All @@ -49,7 +50,7 @@ <h2 class="details-header">{{#t}}pages.check-details-error.corrected-details-tab
<tr>
<td>{{#t}}fields.last-name-error-checkbox.label{{/t}}</td>
<td>
{{values.last-name-error}}
{{values.last-name-error-truncated}}
</td>
<td><a href="about-error/edit#last-name-error" class="button">{{#t}}buttons.change.last-name-error{{/t}}</a></td>
</tr>
Expand All @@ -59,7 +60,7 @@ <h2 class="details-header">{{#t}}pages.check-details-error.corrected-details-tab
<tr>
<td>{{#t}}fields.birth-place-error-checkbox.label{{/t}}</td>
<td>
{{values.birth-place-error}}
{{values.birth-place-error-truncated}}
</td>
<td><a href="about-error/edit#birth-place-error" class="button">{{#t}}buttons.change.birth-place-error{{/t}}</a></td>
</tr>
Expand Down
13 changes: 9 additions & 4 deletions apps/correct-mistakes/views/exit-truncated.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@
{{/header}}

{{$content}}
<p>{{#t}}pages.exit-truncated.title{{/t}}</p>

<p>{{#t}}pages.exit-truncated.paras.one{{/t}}</p>
{{#values.truncatedDetail}}
<p><strong>{{prettyName}}</strong></p>

<p>{{translations.paras.one}}{{max}}{{translations.paras.two}}</p>

<p>{{#t}}pages.exit-truncated.paras.two{{/t}}</p>

<p>{{#t}}pages.exit-truncated.paras.three{{/t}}</p>
<p>{{translations.paras.three}}</p>

<p>{{translations.paras.four}}</p>
{{/values.truncatedDetail}}

<a href='https://www.gov.uk/done/brp-report-problem' class='button'>{{#t}}buttons.close{{/t}}</a>

{{/content}}
Expand Down
2 changes: 1 addition & 1 deletion apps/correct-mistakes/views/truncated.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<p><strong>{{truncatedItem.value}}</strong></p>

<p>{{#t}}pages.truncated.paras.two.parts.one{{/t}} {{truncatedItem.pretty}} {{#t}}pages.truncated.paras.two.parts.two{{/t}} {{truncatedItem.length}} {{#t}}pages.truncated.paras.two.parts.three{{/t}}</p>
<p>{{#t}}pages.truncated.paras.two.parts.one{{/t}} {{truncatedItem.pretty}} {{#t}}pages.truncated.paras.two.parts.two{{/t}} {{truncatedItem.length}} {{#t}}pages.truncated.paras.two.parts.three{{/t}}{{truncatedItem.max}}{{#t}}pages.truncated.paras.two.parts.four{{/t}}</p>

<p><strong>{{truncatedItem.slice}}</strong></p>

Expand Down
3 changes: 3 additions & 0 deletions apps/lost-stolen/fields/personal-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ module.exports = {
value: 'true',
field: 'use-address'
}
},
passport: {
validate: ['required', 'notUrl']
}
};
2 changes: 1 addition & 1 deletion apps/lost-stolen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
next: '/personal-details'
},
'/personal-details': {
fields: ['fullname', 'date-of-birth', 'nationality', 'brp-card'],
fields: ['fullname', 'date-of-birth', 'nationality', 'brp-card', 'passport'],
backLink: 'date-lost',
next: '/contact-details'
},
Expand Down
Loading