1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

Merge branch 'main' into PM-26250-Explore-options-to-enable-direct-importer-for-mac-app-store-build

This commit is contained in:
John Harrington
2025-12-04 15:42:41 -07:00
committed by GitHub
2 changed files with 35 additions and 19 deletions

View File

@@ -627,11 +627,11 @@ export default class NotificationBackground {
} }
const username: string | null = data.username || null; const username: string | null = data.username || null;
const currentPassword = data.password || null; const currentPasswordFieldValue = data.password || null;
const newPassword = data.newPassword || null; const newPasswordFieldValue = data.newPassword || null;
if (authStatus === AuthenticationStatus.Locked && newPassword !== null) { if (authStatus === AuthenticationStatus.Locked && newPasswordFieldValue !== null) {
await this.pushChangePasswordToQueue(null, loginDomain, newPassword, tab, true); await this.pushChangePasswordToQueue(null, loginDomain, newPasswordFieldValue, tab, true);
return true; return true;
} }
@@ -657,35 +657,49 @@ export default class NotificationBackground {
const [cipher] = ciphers; const [cipher] = ciphers;
if ( if (
username !== null && username !== null &&
newPassword === null && newPasswordFieldValue === null &&
cipher.login.username.toLowerCase() === normalizedUsername && cipher.login.username.toLowerCase() === normalizedUsername &&
cipher.login.password === currentPassword cipher.login.password === currentPasswordFieldValue
) { ) {
// Assumed to be a login // Assumed to be a login
return false; return false;
} }
} }
if (currentPassword && !newPassword) { if (
ciphers.length > 0 &&
currentPasswordFieldValue?.length &&
// Only use current password for change if no new password present. // Only use current password for change if no new password present.
if (ciphers.length > 0) { !newPasswordFieldValue
await this.pushChangePasswordToQueue( ) {
ciphers.map((cipher) => cipher.id), const currentPasswordMatchesAnExistingValue = ciphers.some(
loginDomain, (cipher) =>
currentPassword, cipher.login?.password?.length && cipher.login.password === currentPasswordFieldValue,
tab, );
);
return true; // The password entered matched a stored cipher value with
// the same username (no change)
if (currentPasswordMatchesAnExistingValue) {
return false;
} }
await this.pushChangePasswordToQueue(
ciphers.map((cipher) => cipher.id),
loginDomain,
currentPasswordFieldValue,
tab,
);
return true;
} }
if (newPassword) { if (newPasswordFieldValue) {
// Otherwise include all known ciphers. // Otherwise include all known ciphers.
if (ciphers.length > 0) { if (ciphers.length > 0) {
await this.pushChangePasswordToQueue( await this.pushChangePasswordToQueue(
ciphers.map((cipher) => cipher.id), ciphers.map((cipher) => cipher.id),
loginDomain, loginDomain,
newPassword, newPasswordFieldValue,
tab, tab,
); );

View File

@@ -335,8 +335,10 @@ export class SearchService implements SearchServiceAbstraction {
if ( if (
login && login &&
login.uris.length && login.uris?.length &&
login.uris.some((loginUri) => loginUri?.uri?.toLowerCase().indexOf(query) > -1) login.uris?.some(
(loginUri) => loginUri?.uri && loginUri.uri.toLowerCase().indexOf(query) > -1,
)
) { ) {
return true; return true;
} }