Skip to content

Limit organisation choice based on email#2963

Open
stephencdaly wants to merge 7 commits into
mainfrom
limit-organisation-choice-based-on-email
Open

Limit organisation choice based on email#2963
stephencdaly wants to merge 7 commits into
mainfrom
limit-organisation-choice-based-on-email

Conversation

@stephencdaly

@stephencdaly stephencdaly commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/LH68oEwk/

Add a show_relevant_organisations_enabled feature flag.

If it is enabled, limit the organisations shown on the organisation selection page to organisations with domains that match the user's email domain.

This PR does not deal with the cases where there are no matching organisations, a single matching organisation. These will be addressed in follow-up PRs.

When there are 30 or fewer organisations for the user's email domain:

Screenshot 2026-07-24 at 15 08 57

Error message:

Screenshot 2026-07-24 at 15 41 44

When "The organisation I work for is not listed" is selected:

Screenshot 2026-07-24 at 15 09 08

When there are more than 30 organisations for the user's email domain:

Screenshot 2026-07-24 at 15 11 20

When the feature flag is disabled (should be the same behaviour/appearance as it is currently, but with updated content in the details component):

Screenshot 2026-07-24 at 15 08 19

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Do the end to end tests need updating before these changes will pass?
  • Has all relevant documentation been updated?

@stephencdaly
stephencdaly force-pushed the limit-organisation-choice-based-on-email branch 2 times, most recently from 938ebee to 627899f Compare July 23, 2026 16:33
If this feature flag is enabled, we will only show the user
organisations with domains that match their email address when they
are asked to choose an organisation.
If the show_relevant_organisations feature flag is enabled, only
include organisations that match the email domain of the user in the
list of organisations in the organisation selection dropdown.

When the selection page is submitted, validate that the selected
organisation is in the list of allowed organisations, and if it is not
show a validation error.

If the feature flag is disabled, the behaviour remains unchanged and
we show all organisations in the dropdown.
Update the content to not refer to the mailing list.
If there are 30 or fewer organisations that match the user's email
domain, display radio buttons instead of an autocomplete field.

Add an option for the user's account not being listed. This commit
does not handle this option being selected yet.
When the "The organisation I work for is not listed" radio option is
selected, render a static page with content telling the user what to
do next.

The body content for this page is the same as the content in the
details component on the select organisation page when the
autocomplete component is shown.
@stephencdaly
stephencdaly force-pushed the limit-organisation-choice-based-on-email branch from 627899f to a5af35b Compare July 24, 2026 14:23
@github-actions

Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2963.admin.review.forms.service.gov.uk/

It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

@stephencdaly
stephencdaly marked this pull request as ready for review July 24, 2026 14:39
@stephencdaly

Copy link
Copy Markdown
Contributor Author

@StephenGill could you review the content in this when you get some time? I've included screenshots of the different variations. I haven't implemented the different pages for no matching organisations or only one matching organisation yet, I'll do that in the next PR.

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.

1 participant