Skip to content

feat: Allow specifying first and last name during registration/signin#3427

Draft
AshCorr wants to merge 2 commits into
mainfrom
ash/first-last-name-on-registration
Draft

feat: Allow specifying first and last name during registration/signin#3427
AshCorr wants to merge 2 commits into
mainfrom
ash/first-last-name-on-registration

Conversation

@AshCorr

@AshCorr AshCorr commented Jun 19, 2026

Copy link
Copy Markdown
Member

What does this change?

Adds 2 fields to the sign-in forms which accept a string value for the users firstName and lastName properties. At the end of the authorization flow these are then used to update the users Okta profile to set their firstName and lastName properties.

Note that this is a backend change at the moment, none of our login forms actually include fields for entering these details yet. Eventually we'd like to update the IFramed Sign-in flow to let guest users submit their name when finishing their Guardian account.

Flow

  1. Read the firstName and lastName fields from the sign-in/registration request.
  2. Set firstName and lastName in the Authorization state cookie.
  3. After the user enters their passcode, during the end of the Authorization flow, read the firstName and lastName cookies from the Authorization state cookie and update the users Okta profile.

Alternatively we could simply set the users first and last name in their Okta profile the moment they submit the login form, however that could potentially allow malicious actors to modify a users first and last name without verifying that they own the account. By pushing it to the end of the authorization flow we can ensure that the user legitimately owns the account.

How has this change been tested?

Ran locally and modified the HTML of the sign in form to have 2 extra fields for firstName and lastName

@AshCorr AshCorr force-pushed the ash/first-last-name-on-registration branch from 1507f10 to 7678c0d Compare June 19, 2026 13:48
@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

@AshCorr AshCorr force-pushed the ash/first-last-name-on-registration branch 2 times, most recently from 7879f9b to b283bb3 Compare June 19, 2026 14:21
@AshCorr AshCorr added the feature Departmental tracking: work on a new feature label Jun 22, 2026
@AshCorr AshCorr force-pushed the ash/first-last-name-on-registration branch from b283bb3 to 9e94dd2 Compare June 22, 2026 08:47
@AshCorr AshCorr added the run_tests Run Playwright & Chromatic label Jun 22, 2026
@AshCorr AshCorr force-pushed the ash/first-last-name-on-registration branch from 9e94dd2 to 724ad2b Compare June 22, 2026 08:50
@AshCorr AshCorr added run_tests Run Playwright & Chromatic and removed run_tests Run Playwright & Chromatic labels Jun 22, 2026
@AshCorr AshCorr force-pushed the ash/first-last-name-on-registration branch from 724ad2b to 01a459b Compare June 22, 2026 09:00
@AshCorr AshCorr added run_tests Run Playwright & Chromatic and removed run_tests Run Playwright & Chromatic labels Jun 22, 2026
@AshCorr AshCorr marked this pull request as ready for review June 22, 2026 09:07
@AshCorr AshCorr requested a review from a team as a code owner June 22, 2026 09:07
confirmationPagePath?: StartIdxFlowParams['authorizationCodeFlowOptions']['confirmationPagePath'];
}): Promise<void> => {
const { email = '' } = req.body;
const { email = '', firstName, secondName } = req.body;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if they're missing, they'll be null I guess?

@paulmr

paulmr commented Jun 22, 2026

Copy link
Copy Markdown
Member

Clever solution! I guess we would need to be careful with this if it was something more security sensitive because (I think...) it would allow someone to send someone else a link that prefilled this data with query params and then when they authenticated it would get submitted without them necessarily being aware, but honestly in this case with it just being their name I don't think we need to worry about that.

Comment on lines +430 to +437
if (authState.data?.firstName || authState.data?.lastName) {
await updateUser(sub, {
profile: {
firstName: authState.data.firstName,
lastName: authState.data.lastName,
},
});
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We probably need to do some error handling and checking if 1 field is null but the other isnt here, but we can do that in a follow up PR when we actually begin implementing the multiple account flow.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh. Copilot did it for me... Hello?

@AshCorr

AshCorr commented Jun 22, 2026

Copy link
Copy Markdown
Member Author

it would allow someone to send someone else a link that prefilled this data with query params and then when they authenticated it would get submitted without them necessarily being aware

We use POST requests rather than GET requests for our forms, so information like the passcode, first name, and last name aren't transmitted as query parameters, but instead as part of the request body. In theory meaning that you couldn't make a URL that prefills any of these fields.

The only field we do prefill sometimes is the email, but we have a specific query parameter for that 1 field.

If we were still using magic links it could be a risk as you could trigger a magic link to get sent to someone, but even then its not particularly feasible as you can only open a magic link in the same browser that triggered it to be sent in the first place.

@AshCorr AshCorr added run_tests Run Playwright & Chromatic and removed run_tests Run Playwright & Chromatic labels Jun 22, 2026
try {
await updateUser(sub, {
profile: {
firstName: authState.data.firstName,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah so I guess authState.data is definitely not null, because at least one of the values tested at line 430 has to be true, and it's ok for either the firstName or the lastName in the updateUser() to be null because they are optional fields.

@AshCorr AshCorr marked this pull request as draft June 26, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature run_tests Run Playwright & Chromatic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants