fix(auth): brand login mail by login source instead of account history#3846
Merged
Conversation
resolveMailWallet forced any account ever linked to a preferred wallet (RealUnit) onto RealUnit branding, so logins via app.dfx.swiss received RealUnit confirmation mails. signInByMail now resolves the originating login wallet once and passes it explicitly, so branding follows the login source (DFX vs. RealUnit).
guarantees branding follows the login source even when an unknown wallet name is passed, so it never falls back to the account-history override
davidleomay
approved these changes
Jun 9, 2026
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.
Problem
Logging in at app.dfx.swiss sent a RealUnit-branded confirmation mail instead of a DFX one.
Cause
resolveMailWallet(notification.service.ts, introduced in #3612) decided mail branding per account, not per login source: if auserDatahad anyUserrow linked to a wallet flaggedisPreferred: true(only RealUnit), every mail got RealUnit branding (template, sender, forced German).signInByMailnever setinput.wallet, so theif (input.wallet) returnearly-out never fired and the account-based override always won — even for app.dfx.swiss logins.Fix
signInByMailnow resolves the originating login wallet once (dto.wallet→getByIdOrName, elsegetDefault) and passes it explicitly asinput.wallet. Branding now follows the login source:wallet: Mail) → DFX brandingwallet: RealUnit) → RealUnit brandingAlso de-duplicates the wallet lookup (resolved once, reused for
createUserDataand the mail).Notes
Relies on the calling client sending its
walleton mail login (app.dfx.swiss already sendsWalletType.MAIL; realunit.app sends its own).tsc --noEmitgreen.