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

Plot search form validations #444

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

EmiliaMakelaVincit
Copy link
Contributor

Adds validators for select application form fields, and also fixes some area search specs page validations that were fixed on the public side earlier.

The fields that will be validated with special validators are:
- Personal identifier (henkilotunnus)
- Company identifier (y-tunnus)
- Email (sahkoposti)
- Control shares (hallintaosuus), evaluated across the entire form
  for all applicants

Any field whose identifier matches the one specified above will automatically
get the relevant validator applied to it.
- Disable past dates
- Allow selecting the same date for both start and end
- Allow omitting the end date
return error || 'Virheellinen henkilötunnus';
}

const result = /^(\d{6})([-+ABCDEFUVWXY])(\d{3})([0-9ABCDEFHJKLMNPRSTUVWXY])$/.exec(value.toUpperCase());
Copy link
Contributor

Choose a reason for hiding this comment

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

I just realised, that backend does not have this touppercase -operation and therefore this could pass the ui validation but fail at the be-side.

Copy link
Contributor Author

@EmiliaMakelaVincit EmiliaMakelaVincit Oct 16, 2023

Choose a reason for hiding this comment

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

            FieldRegexValidator(
                "^[0-9]{6}[+Aa-][0-9]{3}[A-z0-9]$", "invalid_ssn", "henkilotunnus"
            ),

To me it does seem it accepts both uppercase and lowercase characters... though incorrectly (A-z includes these characters besides the intended letters: [\]^_`). That set by itself is a bit too wide as letters like Q never appear as the check character, though. It also doesn't seem to accept the recently added additional separator characters.

Right, the actual validation in answer.py does the actual math properly, and indeed doesn't accept lowercase characters. The separator problem remains in the regex, however.

Copy link
Contributor

@PasiVuohijoki PasiVuohijoki left a comment

Choose a reason for hiding this comment

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

I wrote a ticket to fix the be-side ssn-validation to transfer the entry to uppercase to have similar results than fe-side validation.

@EmiliaMakelaVincit EmiliaMakelaVincit merged commit 01b03b5 into develop Oct 26, 2023
2 checks passed
@EmiliaMakelaVincit EmiliaMakelaVincit deleted the plot-search-form-validations branch October 26, 2023 08:27
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.

2 participants