-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin-form): support nric masking (#7388)
* feat(admin-form): add frontend nric mask toggle to singpass auth settings * fix(admin-form): fix spacing and change units from px to rem * feat(admin-form): create isNricMaskingEnabled field in database when form is created * feat(admin-form): enable fetching and updating isNricMaskingEnabled field in backend routes * feat(admin-form): connect frontend component with server api routes * fix(admin-form): make code terser, remove unused params, fix nullish-coalesce operator usage * fix(admin-page): fix flickering bug * feat(duplicate-api): implement duplication of isNricMaskEnabled field * feat(public-form): prevent nric from reaching frontend if masked * feat(nric-mask): apply masking when submitting forms * feat(nric-mask): update frontend template to reflect masking toggle changes * fix(index.html): checkout to develop branch * fix: remove console.log * fix(toggle-component): replace nullish coalesce with ternary operator * chore(public-form-controller): remove masking when fetching public form at backend * fix: refactor email-submission-controller to mask at single location * fix: clean up nric-mask util function and unused imports * fix: update field with evaluated map value * feat: add nric masking to the frontend public form provider * feat: remove tooltip and labelComponentRight from Toggle to match design * feat: update settings auth page to reflect design master * feat: add err message * feat: change px to rem * feat: disable independently for nric masking and auth toggle * fix: change MyInfo to Myinfo in description message * fix: update form model test suite to expect new isNricMaskEnabled field * feat: add tests for nric mask util and masking for email submission * feat: add test for isNricMaskDisabled for email submission * feat: add tests for storage mode submission masking * fix: fix bug with submission not being able to save authType and defaulting to nil * feat: add stories for updated settings auth page * feat: update playwright test helper to support new auth setting flow * fix: fix review comments and run frontend lint fix * fix: fix based on chromatic review * fix: fix review comments * feat: add testing for getDuplicateParams to ensure that nricmask is correctly duplicated * refactor: extract skeleton component out to own file --------- Co-authored-by: Ken <[email protected]>
- Loading branch information
1 parent
c6ba38d
commit 79106eb
Showing
35 changed files
with
1,050 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export const PREVIEW_MOCK_UINFIN = 'S1234567A' | ||
export const PREVIEW_MASKED_MOCK_UINFIN = '*****567A' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...atures/admin-form/settings/components/AuthSettingsSection/AuthSettingsDescriptionText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Text } from '@chakra-ui/react' | ||
|
||
import { GUIDE_SPCP_ESRVCID } from '~constants/links' | ||
import Link from '~components/Link' | ||
|
||
export const AuthSettingsDescriptionText = () => { | ||
return ( | ||
<Text textStyle="subhead-1" color="secondary.500" mb="2.5rem" mt="2.5rem"> | ||
Authenticate respondents by NRIC/FIN.{' '} | ||
<Link | ||
textStyle="subhead-1" | ||
href={GUIDE_SPCP_ESRVCID} | ||
isExternal | ||
// Needed for link to open since there are nested onClicks | ||
onClickCapture={(e) => e.stopPropagation()} | ||
> | ||
Learn more about Singpass authentication | ||
</Link> | ||
</Text> | ||
) | ||
} |
33 changes: 33 additions & 0 deletions
33
...dmin-form/settings/components/AuthSettingsSection/AuthSettingsDisabledExplanationText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Box } from '@chakra-ui/react' | ||
|
||
import InlineMessage from '~components/InlineMessage' | ||
|
||
interface AuthSettingsDisabledExplanationTextProps { | ||
isFormPublic: boolean | ||
containsMyInfoFields: boolean | ||
} | ||
|
||
const CONTAINS_MYINFO_FIELDS_DISABLED_EXPLANATION_TEXT = | ||
'To change Singpass authentication settings, close your form to new responses and remove all existing Myinfo fields.' | ||
const FORM_IS_PUBLIC_DISABLED_EXPLANATION_TEXT = | ||
'To change Singpass authentication settings, close your form to new responses.' | ||
|
||
export const AuthSettingsDisabledExplanationText = ({ | ||
isFormPublic, | ||
containsMyInfoFields, | ||
}: AuthSettingsDisabledExplanationTextProps) => { | ||
const explanationText = containsMyInfoFields | ||
? CONTAINS_MYINFO_FIELDS_DISABLED_EXPLANATION_TEXT | ||
: isFormPublic | ||
? FORM_IS_PUBLIC_DISABLED_EXPLANATION_TEXT | ||
: null | ||
|
||
if (!explanationText) { | ||
return null | ||
} | ||
return ( | ||
<Box my="2.5rem"> | ||
<InlineMessage mb="1rem">{explanationText}</InlineMessage> | ||
</Box> | ||
) | ||
} |
Oops, something went wrong.