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

feat: myinfo for storage-mode #6870

Merged
merged 27 commits into from
Nov 15, 2023
Merged

feat: myinfo for storage-mode #6870

merged 27 commits into from
Nov 15, 2023

Conversation

wanlingt
Copy link
Contributor

@wanlingt wanlingt commented Nov 6, 2023

Problem

We want to make MyInfo fields available on storage-mode forms now that we've done the encryption boundary shift, and are able to validate form responses

Closes FRM-1430

Solution

Frontend

  • Allow admin to choose Singpass MyInfo or SGID MyInfo in a form's auth settings

Backend

  • Add MyInfo and SGID_MyInfo to the form model
  • Validate MyInfo hashes in encrypt-submission.middleware. This is done in the validateStorageSubmission step, before the form responses are encrypted. We also format the question name by prefixing it with [MyInfo] if it is verified in this step. Each subfield in a Child Record is listed as a new field in the form response.
  • Inject the user's NRIC as verified content in encrypt-submission.controller

Other fixes

  • Changed the login cookie name from connect.sid to formsg.connect.sid in local dev.
    • Why: For MyInfo-authenticated forms, Mockpass replaces the connect-sid value which would log the admin out of their account. This was causing the new MyInfo playwright test to fail.
    • A separate ticket (FRM-1512) has been created to standardise the login cookie name to formsg.connect.sid across all environments.

Breaking Changes

  • No - this PR is backwards compatible

Before & After Screenshots

Location/Modifier Before After
Authentication settings image image
Duplicate myinfo-authenticated email-mode form as a storage-mode form image image

Tests

  1. Submit normal storage mode form, without MyInfo fields (regression)
  • Create a normal storage mode form with no authentication
  • You should be able to submit the form successfully

Singpass MyInfo
2a. Submit storage mode form with Singpass MyInfo fields

  • Create a normal storage mode form with Singpass MyInfo as the authentication type
  • Add at least the following MyInfo fields: Name, DOB, Nationality, Vehicle Type, Child
  • Add an attachment field
  • Add a payment field
  • Set up a webhook receiver and update the URL in the form's settings
  • You should be able to submit the form successfully
  • Navigate to the responses page, check that the response shows up
  • Click into the response. All the results should be there
  • Download the responses as a CSV. All the results should be there
  • The form responses should be sent via webhook and decrypted successfully

2b. Duplicate email mode form as storage mode using the duplicate button

  • Create an email mode form set to Singpass MyInfo as the authentication type
  • Duplicate the form, this time as a storage mode form
  • Navigate to the form's settings page. The authentication type should be set to Singpass MyInfo instead of NIL

2c. Duplicate email mode form as storage mode using the use-template link

  • Create an email mode form set to Singpass MyInfo as the authentication type
  • Duplicate the form by using the use-template link, this time as a storage mode form
  • Navigate to the form's settings page. The authentication type should be set to Singpass MyInfo instead of NIL

SGID MyInfo
3a. Submit storage mode form with SGID MyInfo fields

  • Create a normal storage mode form with SGID MyInfo as the authentication type
  • Add at least the following MyInfo fields: Name, DOB, Nationality, Vehicle Type, Child
  • Add an attachment field
  • Add a payment field
  • Set up a webhook receiver and update the URL in the form's settings
  • You should be able to submit the form successfully
  • Navigate to the responses page, check that the response shows up
  • Click into the response. All the results should be there
  • Download the responses as a CSV. All the results should be there
  • The form responses should be sent via webhook and decrypted successfully

3b. Duplicate email mode form as storage mode

  • Create an email mode form set to SGID MyInfo as the authentication type
  • Duplicate the form, this time as a storage mode form
  • Navigate to the form's settings page. The authentication type should be set to SGID MyInfo instead of NIL

3c. Duplicate email mode form as storage mode using the use-template link

  • Create an email mode form set to SGID MyInfo as the authentication type
  • Duplicate the form by using the use-template link, this time as a storage mode form
  • Navigate to the form's settings page. The authentication type should be set to SGID MyInfo instead of NIL

Copy link

linear bot commented Nov 7, 2023

FRM-1430 MyInfo storage mode

Description

Implement MyInfo on storage mode forms

Additional context

RFC

Todo

  • Check if there's a limit to the number of myinfo fields allowed on storage mode (change copy?)
  • Announcement to admins?

Blockers

@wanlingt wanlingt marked this pull request as ready for review November 7, 2023 10:12
@wanlingt wanlingt requested a review from KenLSM November 15, 2023 00:41
Copy link
Contributor

@KenLSM KenLSM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Happy to see that we're removing lots of code too!

@wanlingt wanlingt enabled auto-merge (squash) November 15, 2023 06:48
@wanlingt wanlingt merged commit 3e8b06a into develop Nov 15, 2023
21 of 22 checks passed
@wanlingt wanlingt deleted the feat/storage-mode-myinfo branch November 15, 2023 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants