Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 19 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,29 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v6.68.0](https://github.com/opengovsg/FormSG/compare/v6.67.1...v6.68.0)

- chore(deps-dev): bump @types/lodash from 4.14.195 to 4.14.196 in /shared [`#6570`](https://github.com/opengovsg/FormSG/pull/6570)
- feat: rm bot protection for GSIB users [`#6568`](https://github.com/opengovsg/FormSG/pull/6568)
- chore: lint and update commands in README [`#6567`](https://github.com/opengovsg/FormSG/pull/6567)
- feat: MyInfo over sgID (frontend) [`#6447`](https://github.com/opengovsg/FormSG/pull/6447)
- chore: rm redundant type assertion in url validation [`#6566`](https://github.com/opengovsg/FormSG/pull/6566)
- feat: updated uen validator (ref stdnum) and tests cases [`#6534`](https://github.com/opengovsg/FormSG/pull/6534)
- fix: subtle bugs in MyInfo Child and UI copyedits [`#6562`](https://github.com/opengovsg/FormSG/pull/6562)
- feat: react router params validator for mongo ids [`#6561`](https://github.com/opengovsg/FormSG/pull/6561)
- build: merge v6.67.1 into develop [`#6559`](https://github.com/opengovsg/FormSG/pull/6559)
- build: release v6.67.1 [`#6557`](https://github.com/opengovsg/FormSG/pull/6557)
- fix: github warning about unused import [`#6558`](https://github.com/opengovsg/FormSG/pull/6558)

#### [v6.67.1](https://github.com/opengovsg/FormSG/compare/v6.67.0...v6.67.1)

> 20 July 2023

- fix: paynow payout being ignored [`#6556`](https://github.com/opengovsg/FormSG/pull/6556)
- build: release v6.67.0 [`#6555`](https://github.com/opengovsg/FormSG/pull/6555)
- chore: bump version to 6.67.1 [`b641094`](https://github.com/opengovsg/FormSG/commit/b641094d40a67a888e3a8ac967a43f9d1732bd49)

#### [v6.67.0](https://github.com/opengovsg/FormSG/compare/v6.66.1...v6.67.0)
#### [v6.67.0](https://github.com/opengovsg/FormSG/compare/v6.66.0...v6.67.0)

> 20 July 2023

Expand All @@ -19,20 +36,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- build: release v6.66.0 [`#6550`](https://github.com/opengovsg/FormSG/pull/6550)
- feat: MyInfo Children compound fields beta [`#6523`](https://github.com/opengovsg/FormSG/pull/6523)
- ci: adjust timeouts for playwright pipe [`#6551`](https://github.com/opengovsg/FormSG/pull/6551)
- fix: use proof-of-payment for payment receipt/invoice [`#6549`](https://github.com/opengovsg/FormSG/pull/6549)
- build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 in /frontend [`#6548`](https://github.com/opengovsg/FormSG/pull/6548)
- fix(deps): bump word-wrap from 1.2.3 to 1.2.4 [`#6547`](https://github.com/opengovsg/FormSG/pull/6547)
- build(deps): bump winston-cloudwatch to v6.2.0 [`#6545`](https://github.com/opengovsg/FormSG/pull/6545)
- chore: bump version to v6.66.0 [`0233ba8`](https://github.com/opengovsg/FormSG/commit/0233ba8018532d4978d13717fac065f81e2eb515)
- chore: bump version to v6.67.0 [`6ca03c6`](https://github.com/opengovsg/FormSG/commit/6ca03c68cb162a4ae3af01f172425b3305742ae0)

#### [v6.66.1](https://github.com/opengovsg/FormSG/compare/v6.66.0...v6.66.1)

> 18 July 2023

- revert: build(deps): bump winston-cloudwatch version to 6.2.0 [`#6542`](https://github.com/opengovsg/FormSG/pull/6542)
- chore: bump version to v6.66.0 [`b3a9818`](https://github.com/opengovsg/FormSG/commit/b3a9818762e334bc7126c029cdba63156bac85ed)

#### [v6.66.0](https://github.com/opengovsg/FormSG/compare/v6.65.0...v6.66.0)

> 19 July 2023
Expand Down Expand Up @@ -405,7 +410,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix: only return previous payment id [`#6210`](https://github.com/opengovsg/FormSG/pull/6210)
- build: merge release v6.45.0 to develop [`#6205`](https://github.com/opengovsg/FormSG/pull/6205)
- build: release v6.45.0 [`#6200`](https://github.com/opengovsg/FormSG/pull/6200)
- chore: bump version to v6.46.0 [`767e7e5`](https://github.com/opengovsg/FormSG/commit/767e7e55c3e8f058963e890b1c249704d6db1459)
- chore: bump version to v6.46.0 [`87fda0e`](https://github.com/opengovsg/FormSG/commit/87fda0e0ec4c937350ebd013a4a9762f4acee802)

#### [v6.45.0](https://github.com/opengovsg/FormSG/compare/v6.44.1...v6.45.0)

Expand Down
29 changes: 29 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2200,6 +2200,35 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-------------------------------------------------------------------------------

## Project
python_stdnum

### Source
https://github.com/arthurdejong/python-stdnum/

### License
uen.py - functions for handling Singapore UEN numbers
coding: utf-8

Copyright (C) 2020 Leandro Regueiro
Copyright (C) 2020 Arthur de Jong

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA


## Project
toastr

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ npm run test:frontend
#### End-to-end tests

```bash
npm run test-e2e
npm run test:e2e-v2
```

will build both the frontend and backend then run our end-to-end tests. The tests are located at [`__tests__/e2e`](./__tests__/e2e). You will need to stop the Docker dev container to be able to run the end-to-end tests.

If you do not need to rebuild the frontend and backend, you can run

```bash
npm run test-e2e-ci
npx playwright test
```

#### Cross-browser testing
Expand Down
2 changes: 1 addition & 1 deletion __tests__/e2e/constants/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export const ALL_FIELDS: E2eFieldMetadata[] = [
{
title: 'Some UEN here please',
fieldType: BasicField.Uen,
val: 'T09LL0001B',
val: 'T09SS0050A',
},
{
title: 'Yes or No?',
Expand Down
16 changes: 5 additions & 11 deletions __tests__/e2e/helpers/createForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,12 @@ const addAuthSettings = async (
page.getByRole('heading', { name: 'Enable Singpass authentication' }),
).toBeVisible()

const name = `Singpass${
formSettings.authType === FormAuthType.SP
? ''
: formSettings.authType === FormAuthType.SGID
? ' App-only Login'
: formSettings.authType === FormAuthType.MyInfo
? ' with MyInfo'
: ' (Corporate)'
}`

await page
.locator('label', { has: page.getByRole('radio', { name }) })
.locator('label', {
has: page.locator(
`input[type='radio'][value='${formSettings.authType}']`,
),
})
.first() // Since 'Singpass' will match all radio options, pick the first matching one.
.click({ position: { x: 1, y: 1 } }) // Clicking the center of the sgid button launches the sgid contact form, put this here until we get rid of the link

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.67.0",
"version": "6.68.0",
"homepage": ".",
"private": true,
"dependencies": {
Expand Down
39 changes: 33 additions & 6 deletions frontend/src/app/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { FormPaymentPage } from '~features/public-form/components/FormPaymentPag
import { BillingPage } from '~features/user/billing'

import { HashRouterElement } from './HashRouterElement'
import { ParamIdValidator } from './ParamIdValidator'
import { PrivateElement } from './PrivateElement'
import { PublicElement } from './PublicElement'

Expand Down Expand Up @@ -109,20 +110,38 @@ export const AppRouter = (): JSX.Element => {
<Route path={PUBLICFORM_ROUTE}>
<Route
index
element={<PublicElement element={<PublicFormPage />} />}
element={
<ParamIdValidator
element={<PublicElement element={<PublicFormPage />} />}
/>
}
/>
<Route
path={USE_TEMPLATE_REDIRECT_SUBROUTE}
element={<PublicElement element={<UseTemplateRedirectPage />} />}
element={
<ParamIdValidator
element={
<PublicElement element={<UseTemplateRedirectPage />} />
}
/>
}
/>
<Route
path={PAYMENT_PAGE_SUBROUTE}
element={<PublicElement element={<FormPaymentPage />} />}
element={
<ParamIdValidator
element={<PublicElement element={<FormPaymentPage />} />}
/>
}
/>
</Route>
<Route
path={`${ADMINFORM_ROUTE}/:formId`}
element={<PrivateElement element={<AdminFormLayout />} />}
element={
<ParamIdValidator
element={<PrivateElement element={<AdminFormLayout />} />}
/>
}
>
<Route index element={<CreatePage />} />
<Route path={ADMINFORM_SETTINGS_SUBROUTE} element={<SettingsPage />}>
Expand All @@ -147,11 +166,19 @@ export const AppRouter = (): JSX.Element => {
</Route>
<Route
path={`${ADMINFORM_ROUTE}/:formId/${ADMINFORM_PREVIEW_ROUTE}`}
element={<PrivateElement element={<PreviewFormPage />} />}
element={
<ParamIdValidator
element={<PrivateElement element={<PreviewFormPage />} />}
/>
}
/>
<Route
path={`${ADMINFORM_ROUTE}/:formId/${ADMINFORM_USETEMPLATE_ROUTE}`}
element={<PrivateElement element={<TemplateFormPage />} />}
element={
<ParamIdValidator
element={<PrivateElement element={<TemplateFormPage />} />}
/>
}
/>
<Route path="*" element={<NotFoundErrorPage />} />
</Routes>
Expand Down
26 changes: 26 additions & 0 deletions frontend/src/app/ParamIdValidator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useParams } from 'react-router-dom'

import { MONGODB_ID_REGEX } from '~constants/routes'

import NotFoundErrorPage from '~pages/NotFoundError'

interface ParamIdValidatorProps {
element: React.ReactElement
}

export const ParamIdValidator = ({ element }: ParamIdValidatorProps) => {
const { formId, submissionId, paymentId } = useParams()

const isInvalidMongoId = (id?: string) => id && !id.match(MONGODB_ID_REGEX)

// Bootstrap route validation as suggested by React Router Docs:
// https://reactrouter.com/en/main/start/faq#what-happened-to-regexp-routes-paths
if (
isInvalidMongoId(formId) ||
isInvalidMongoId(submissionId) ||
isInvalidMongoId(paymentId)
)
return <NotFoundErrorPage />

return element
}
2 changes: 1 addition & 1 deletion frontend/src/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const BILLING_ROUTE = '/billing'
// the regex in PublicFormPage.
export const PUBLICFORM_ROUTE = '/:formId'
export const USE_TEMPLATE_REDIRECT_SUBROUTE = 'use-template'
export const FORMID_REGEX = /^([a-fA-F0-9]{24})$/
export const MONGODB_ID_REGEX = /^([a-fA-F0-9]{24})$/

export const ADMINFORM_ROUTE = '/admin/form'
/** Build tab has no subroute, its the index admin form route. */
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/features/admin-form/common/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AdminFormDto, PreviewFormViewDto } from '~shared/types/form/form'

import { ApiError } from '~typings/core'

import { FORMID_REGEX } from '~constants/routes'
import { MONGODB_ID_REGEX } from '~constants/routes'

import { useUser } from '~features/user/queries'

Expand Down Expand Up @@ -134,7 +134,7 @@ export const usePreviewForm = (
{
// Treat preview form as static on load.
staleTime: Infinity,
enabled: FORMID_REGEX.test(formId) && enabled,
enabled: MONGODB_ID_REGEX.test(formId) && enabled,
},
)
}
Expand All @@ -150,7 +150,7 @@ export const useFormTemplate = (
{
// Treat preview form as static on load.
staleTime: Infinity,
enabled: FORMID_REGEX.test(formId) && enabled,
enabled: MONGODB_ID_REGEX.test(formId) && enabled,
},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ export const EditMyInfoChildren = ({
</HStack>
</VStack>
<VStack align="flex-start">
<Text textStyle="subhead-1">
Collect the following child information
</Text>
<Text textStyle="subhead-1">Collect the following child data</Text>
<Box alignSelf="stretch">
<Controller
control={control}
Expand Down
Loading