Browse Source

Review fix

pull/7295/head
Timshel 3 weeks ago
parent
commit
c99ffe3d83
  1. 7
      src/api/core/accounts.rs

7
src/api/core/accounts.rs

@ -129,14 +129,17 @@ impl RegisterData {
self.compat.fold(|rdc| &rdc.key, |rdcu| &rdcu.master_password_unlock.key).to_owned() self.compat.fold(|rdc| &rdc.key, |rdcu| &rdcu.master_password_unlock.key).to_owned()
} }
// When comparing with salt, email need to be normalized:
// - https://github.com/bitwarden/clients/blob/web-v2026.5.0/libs/common/src/key-management/master-password/services/master-password.service.ts#L171
fn unprocessable(&self) -> bool { fn unprocessable(&self) -> bool {
let mut unprocessable = false; let mut unprocessable = false;
*self.compat.fold( *self.compat.fold(
|_| &false, |_| &false,
|rdcu| { |rdcu| {
let email = self.email.trim().to_lowercase();
unprocessable = rdcu.master_password_authentication.kdf != rdcu.master_password_unlock.kdf unprocessable = rdcu.master_password_authentication.kdf != rdcu.master_password_unlock.kdf
|| rdcu.master_password_authentication.salt != self.email || rdcu.master_password_authentication.salt != email
|| rdcu.master_password_unlock.salt != self.email; || rdcu.master_password_unlock.salt != email;
&unprocessable &unprocessable
}, },
) )

Loading…
Cancel
Save