Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/subdomains/generic/user/models/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ export class AuthService {
const ipCountry = this.geoLocationService.getCountry(userIp);
const language = await this.languageService.getLanguageByCountry(ipCountry);

// wallet the login originated from - determines mail branding (e.g. DFX vs. RealUnit);
// always resolve to a concrete wallet so branding follows the login source and never falls back to account history
const loginWallet =
(dto.wallet && (await this.walletService.getByIdOrName(undefined, dto.wallet))) ||
(await this.walletService.getDefault());

const userData =
(await this.userDataService
.getUsersByMail(dto.mail)
Expand All @@ -268,9 +274,7 @@ export class AuthService {
mail: dto.mail,
language: dto.language ?? language,
status: UserDataStatus.KYC_ONLY,
wallet: dto.wallet
? await this.walletService.getByIdOrName(undefined, dto.wallet)
: await this.walletService.getDefault(),
wallet: loginWallet,
}));

if (dto.recommendationCode) await this.confirmRecommendationCode(dto.recommendationCode, userData);
Expand Down Expand Up @@ -301,6 +305,7 @@ export class AuthService {
context: MailContext.LOGIN,
input: {
userData,
wallet: loginWallet,
title: `${MailTranslationKey.LOGIN}.title`,
salutation: { key: `${MailTranslationKey.LOGIN}.salutation` },
texts: [
Expand Down