Leave name and email to 3AG Accounts - #12
Merged
Merged
Conversation
The profile page offered a name and an email address to edit, and neither was this app's to change. Single sign-on force-fills both from the Accounts claims on every login, so an edit here survived exactly until the user signed in again. The email field was worse than useless. Invitations are found by pendingFor($user->email) and accepted on a lowercased string comparison, so typing a colleague's address into this form and saving was enough to be offered their pending invitations -- no verification anywhere in the path. The page already said password, two-factor and passkeys lived in Accounts; name and email always belonged in that sentence too. So the form goes, along with the request and the validation rules that only it used, and the page becomes a read-only view of what Accounts holds with a link to go and change it there. Refuse an email_verified of false while here. Accounts will not issue a code for an unverified address now, so this should never fire -- but the address decides which invitations the signer can accept and which pre-existing account they adopt, which is more than should rest on the identity provider alone holding its end up. A missing claim still signs in: OIDC makes it optional, so its absence means the issuer did not say, and refusing on that would empty the app the day Accounts stopped sending it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The profile page offered a name and an email address to edit, and neither was this app's to change. The SSO callback force-fills both from the Accounts claims on every login, so an edit here survived exactly until the user signed in again.
The email field was worse than useless. Invitations are found by
pendingFor($user->email)and accepted on a lowercased string comparison — so typing a colleague's address into this form and hitting Save was enough to be offered their pending invitations, with no verification anywhere in the path.The page already said password, two-factor and passkeys live in 3AG Accounts. Name and email always belonged in that sentence too.
What changed
resources/js/pages/settings/profile.tsxis now a read-only view of what Accounts holds, with a "Manage in 3AG Accounts" link.ProfileController::update,ProfileUpdateRequest, theProfileValidationRulesconcern (used by nothing else), and thePATCH settings/profileroute.Defence in depth
The SSO callback now refuses an
email_verifiedoffalse.3agApp/Accounts#4 stops Accounts issuing a code for an unverified address, so this should never fire. It is here because the address decides which invitations the signer can accept and which pre-existing local account they adopt — more than should rest on the identity provider alone holding its end up.
A missing claim still signs in. OIDC makes
email_verifiedoptional, so its absence means the issuer did not say, not that it said no; refusing on that would empty the app the day Accounts stopped sending it. There is a test pinning each of the three cases.Suite consistency
AccountsOidc.php,AccountsUser.php,AccountsOidcException.php, the newprofile.tsxand the new browser test are byte-identical across ProductSyncManager, SalesReport and CompliancePlatform.Testing
Feature, Browser, Pint, PHPStan,
npm run checkandtsc --noEmitall clean. Also walked the whole flow by hand in the browser against local Accounts: sign in through SSO, land on the profile page, confirm the name and email render and that noname/emailinput exists on the page.🤖 Generated with Claude Code