Skip to content

Mail login: empty ?wallet= bypasses DFX Wallet default (follow-up to #1161) #1380

Description

@marassteiner

EN: Empty ?wallet= is forwarded as '' and therefore skips the new DFX Wallet default on mail login.
DE: Ein leeres ?wallet= wird als '' weitergereicht und umgeht damit den neuen DFX-Wallet-Default beim Mail-Login.

Details

Context

Follow-up from review of #1161 (head f64d21e5).

The mail-login default uses nullish coalescing:

// src/components/home/wallet/connect-mail.tsx:70
signInWithMail(mail, redirectUri, recommendationCode, wallet ?? DFX_WALLET_NAME)

?? treats only null/undefined as missing. An empty URL param is preserved as '' and sent to POST /v1/auth/mail unchanged.

Evidence

  • src/components/home/wallet/connect-mail.tsx:70wallet ?? DFX_WALLET_NAME
  • src/contexts/app-handling.context.tsx:255getParameter is query.get(key) ?? undefined, so ?wallet= stays ''
  • src/contexts/app-handling.context.tsx:358 — that value is stored as wallet
  • src/__tests__/connect-mail-redirect.test.tsx:155 and :174 cover undefined and 'RealUnit', not ''

This is a pre-existing empty-param path. The PR did not introduce it; it only added a default for absent params. It is not a merge blocker for #1161 — the stated contract is that an explicit ?wallet= is forwarded (??).

Suggested fix

If empty should count as missing:

signInWithMail(mail, redirectUri, recommendationCode, wallet || DFX_WALLET_NAME)

(or, if host-scoping from #1332 lands, only in that branch). Add a unit case with { wallet: '' }.

If empty should stay explicit, no code change — just add the test so the ?? contract is locked in.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions