Skip to content

Commit

Permalink
Update all regex instances, trim accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyEPhipps committed Mar 27, 2024
1 parent c1fa435 commit 4b3610c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/pages/GiftAid/GiftAid.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ function GiftAid(props) {

if (validity) { // submit form if no errors
setIsSubmitting(true); // Update state that's passed down to disable button during submission
// Rather than mess with the input field value itself (crummy UX), just sanitise the value on submission,
// removing any leading or trailing whitespace that the new regex brings allows for (see ENG-3193)
formValues.donationID = formValues.donationID.trim();

axios.post(pathParams.endpoint, formValues) // post form data and settings to endpoint
.then(() => {
setIsCompleted(true); // set completed state
Expand Down
2 changes: 1 addition & 1 deletion src/pages/GiftAid/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const justInTimeLinkText = 'Why do we collect this info?';
* REGEX for transactionId
*
*/
const transactionIdPattern = '^[a-zA-Z0-9-_]{5,}$';
const transactionIdPattern = '^\\s{0,1}[a-zA-Z0-9-_]{5,}\\s{0,1}$';

/**
* Function to validate form
Expand Down

0 comments on commit 4b3610c

Please sign in to comment.