[superlog] Show actionable 'wrong account' UI on invitation recipient mismatch#76
Open
superlog-app[bot] wants to merge 1 commit into
Open
[superlog] Show actionable 'wrong account' UI on invitation recipient mismatch#76superlog-app[bot] wants to merge 1 commit into
superlog-app[bot] wants to merge 1 commit into
Conversation
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.
Summary
Users who click an org invitation link while signed in as a different account see a raw
"You are not the recipient of the invitation"error with no recovery path. The invitation accept page was designed to show a friendly "This invite was sent to X, but you're signed in as Y" warning and prevent the Accept button, but that branch was dead code —better-auth'sgetInvitationendpoint throws 403 before returning any invitation data when the signed-in email doesn't match the invitation email.The
wrongAccountcheck (and the blocked Accept button) inAcceptInvitationInnercould never be reached:invite.emailis only populated on the success path, which is unreachable when emails don't match.This patch adds a
wrong-accountstate toLoadStateand detects the specific 403 error message frombetter-auth. When triggered, the component shows a clear warning and a Sign out button so the user can sign in with the invited address and complete the flow. The deadwrongAccountvariable and its associated disabled-button logic are removed.An alternative approach would be to accept the invitation link URL without requiring authentication (serving a public preview of the invite), but that would require a
better-authAPI change or a custom server-side endpoint.Incident on Superlog
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Fix wrong-account flow on org invitations by detecting recipient mismatches and showing a clear warning with a Sign out action instead of a raw error.
403frombetter-authgetInvitation("You are not the recipient of the invitation") via a newwrong-accountload state.wrongAccountlogic anduserEmailprop; Accept is only disabled during in-flight actions.Written for commit 1e9efb3. Summary will update on new commits.