monocle / recordexpungPDX

A project to automate the expungement of qualifying criminal records in Oregon. This project is done in conjunction with Qiu-Qiu Law.
https://recordsponge.com
MIT License
0 stars 0 forks source link

Should /fill-expungement-forms redirect? #14

Open monocle opened 1 year ago

monocle commented 1 year ago

Currently in production, if visiting /fill-expungement-forms without doing anything else prior, it will display FillForms and UserDataForm.

But in UserDataForm there is this: https://github.com/monocle/recordexpungPDX/blob/25a376c3fd5ab770d54a4734ee0b21c0c973ca9a/src/frontend/src/components/FillForms/UserDataForm.tsx#L120-L124

So it seems that this route should not be accessible unless there are previous aliases. However, there seems to always be at least one blank alias:

image
KentShikama commented 1 year ago

Not sure I follow. Are you saying that you can get to the "Generate Expungement Forms" without having searched a person? And thus once you fill out the form and hit submit, you would get blank forms?

monocle commented 1 year ago

@KentShikama Currently, in production, it's possible to visit https://recordsponge.com/fill-expungement-forms without being logged in. Is that okay?

But based on

https://github.com/monocle/recordexpungPDX/blob/25a376c3fd5ab770d54a4734ee0b21c0c973ca9a/src/frontend/src/components/FillForms/UserDataForm.tsx#L120-L124

it seems like if someone is not logged in or no search has been done yet, there should be a redirect to /record-search.

Currently, that check on props.aliases.length is always true (edit: before making a search) because the initial state is

https://github.com/monocle/recordexpungPDX/blob/842056fdd6e710721ac492ea5710f72cdf493f6e/src/frontend/src/redux/search/reducer.ts#L25-L37

If there's a use case to be able to fill those forms out without having done a search or being logged in, I can just remove that redirect logic from the component.

edit: Should we add a login check and then check for an empty first alias?