Skip to content

Commit 7ce1148

Browse files
authored
fix: Bitwarden returns old domain if exists (#4601)
Our Bitwarden clients read the email from the access_token, so to avoid having to update all the clients, we can also return the old domain if it exists. That should fix our issues.
2 parents 5e9e806 + 44a5a52 commit 7ce1148

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

model/instance/instance.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,14 @@ func (i *Instance) HasForcedOIDC() bool {
497497

498498
// PassphraseSalt computes the salt for the client-side hashing of the master
499499
// password. The rule for computing the salt is to create a fake email address
500-
// "me@<domain>".
500+
// "me@<domain>". If OldDomain is set, it uses the old domain for backward
501+
// compatibility during domain migration.
501502
func (i *Instance) PassphraseSalt() []byte {
502-
domain := strings.Split(i.Domain, ":")[0] // Skip the optional port
503+
domain := i.Domain
504+
if i.OldDomain != "" {
505+
domain = i.OldDomain
506+
}
507+
domain = strings.Split(domain, ":")[0] // Skip the optional port
503508
return []byte("me@" + domain)
504509
}
505510

0 commit comments

Comments
 (0)