Skip to content

Commit

Permalink
Merge branch 'main' into billing/AC-2554/prevent-unnecessary-billing-…
Browse files Browse the repository at this point in the history
…status-calls
  • Loading branch information
amorask-bitwarden committed May 6, 2024
2 parents a67c01c + ff30211 commit bd3ee33
Show file tree
Hide file tree
Showing 141 changed files with 1,055 additions and 623 deletions.
30 changes: 15 additions & 15 deletions apps/browser/src/_locales/en_IN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
"message": "Help & feedback"
},
"helpCenter": {
"message": "Bitwarden Help center"
"message": "Bitwarden Help centre"
},
"communityForums": {
"message": "Explore Bitwarden community forums"
Expand Down Expand Up @@ -728,7 +728,7 @@
"message": "Change the application's colour theme."
},
"themeDescAlt": {
"message": "Change the application's color theme. Applies to all logged in accounts."
"message": "Change the application's colour theme. Applies to all logged in accounts."
},
"dark": {
"message": "Dark",
Expand Down Expand Up @@ -1165,7 +1165,7 @@
"message": "Show a recognizable image next to each login."
},
"faviconDescAlt": {
"message": "Show a recognizable image next to each login. Applies to all logged in accounts."
"message": "Show a recognisable image next to each login. Applies to all logged in accounts."
},
"enableBadgeCounter": {
"message": "Show badge counter"
Expand Down Expand Up @@ -1730,7 +1730,7 @@
"message": "An organization policy is affecting your ownership options."
},
"personalOwnershipPolicyInEffectImports": {
"message": "An organization policy has blocked importing items into your individual vault."
"message": "An organisation policy has blocked importing items into your individual vault."
},
"excludedDomains": {
"message": "Excluded Domains"
Expand Down Expand Up @@ -1990,7 +1990,7 @@
"message": "Your Master Password was recently changed by an administrator in your organization. In order to access the vault, you must update it now. Proceeding will log you out of your current session, requiring you to log back in. Active sessions on other devices may continue to remain active for up to one hour."
},
"updateWeakMasterPasswordWarning": {
"message": "Your master password does not meet one or more of your organization policies. In order to access the vault, you must update your master password now. Proceeding will log you out of your current session, requiring you to log back in. Active sessions on other devices may continue to remain active for up to one hour."
"message": "Your master password does not meet one or more of your organisation policies. In order to access the vault, you must update your master password now. Proceeding will log you out of your current session, requiring you to log back in. Active sessions on other devices may continue to remain active for up to one hour."
},
"resetPasswordPolicyAutoEnroll": {
"message": "Automatic Enrollment"
Expand All @@ -2006,11 +2006,11 @@
"description": "Used as a message within the notification bar when no folders are found"
},
"orgPermissionsUpdatedMustSetPassword": {
"message": "Your organization permissions were updated, requiring you to set a master password.",
"message": "Your organisation permissions were updated, requiring you to set a master password.",
"description": "Used as a card title description on the set password page to explain why the user is there"
},
"orgRequiresYouToSetPassword": {
"message": "Your organization requires you to set a master password.",
"message": "Your organisation requires you to set a master password.",
"description": "Used as a card title description on the set password page to explain why the user is there"
},
"verificationRequired": {
Expand All @@ -2037,7 +2037,7 @@
}
},
"vaultTimeoutPolicyWithActionInEffect": {
"message": "Your organization policies are affecting your vault timeout. Maximum allowed vault timeout is $HOURS$ hour(s) and $MINUTES$ minute(s). Your vault timeout action is set to $ACTION$.",
"message": "Your organisation policies are affecting your vault timeout. Maximum allowed vault timeout is $HOURS$ hour(s) and $MINUTES$ minute(s). Your vault timeout action is set to $ACTION$.",
"placeholders": {
"hours": {
"content": "$1",
Expand All @@ -2054,7 +2054,7 @@
}
},
"vaultTimeoutActionPolicyInEffect": {
"message": "Your organization policies have set your vault timeout action to $ACTION$.",
"message": "Your organisation policies have set your vault timeout action to $ACTION$.",
"placeholders": {
"action": {
"content": "$1",
Expand Down Expand Up @@ -2111,7 +2111,7 @@
"message": "Exporting Personal Vault"
},
"exportingIndividualVaultDescription": {
"message": "Only the individual vault items associated with $EMAIL$ will be exported. Organization vault items will not be included. Only vault item information will be exported and will not include associated attachments.",
"message": "Only the individual vault items associated with $EMAIL$ will be exported. Organisation vault items will not be included. Only vault item information will be exported and will not include associated attachments.",
"placeholders": {
"email": {
"content": "$1",
Expand Down Expand Up @@ -2305,7 +2305,7 @@
}
},
"autofillPageLoadPolicyActivated": {
"message": "Your organization policies have turned on auto-fill on page load."
"message": "Your organisation policies have turned on auto-fill on page load."
},
"howToAutofill": {
"message": "How to auto-fill"
Expand Down Expand Up @@ -2377,7 +2377,7 @@
"message": "Approve with master password"
},
"ssoIdentifierRequired": {
"message": "Organization SSO identifier is required."
"message": "Organisation SSO identifier is required."
},
"eu": {
"message": "EU",
Expand Down Expand Up @@ -2688,7 +2688,7 @@
"message": "Total"
},
"importWarning": {
"message": "You are importing data to $ORGANIZATION$. Your data may be shared with members of this organization. Do you want to proceed?",
"message": "You are importing data to $ORGANIZATION$. Your data may be shared with members of this organisation. Do you want to proceed?",
"placeholders": {
"organization": {
"content": "$1",
Expand Down Expand Up @@ -3007,10 +3007,10 @@
"message": "Passkey removed"
},
"unassignedItemsBannerNotice": {
"message": "Notice: Unassigned organization items are no longer visible in the All Vaults view and only accessible via the Admin Console."
"message": "Notice: Unassigned organisation items are no longer visible in the All Vaults view and only accessible via the Admin Console."
},
"unassignedItemsBannerSelfHostNotice": {
"message": "Notice: On May 16, 2024, unassigned organization items will no longer be visible in the All Vaults view and will only be accessible via the Admin Console."
"message": "Notice: On May 16, 2024, unassigned organisation items will no longer be visible in the All Vaults view and will only be accessible via the Admin Console."
},
"unassignedItemsBannerCTAPartOne": {
"message": "Assign these items to a collection from the",
Expand Down
26 changes: 13 additions & 13 deletions apps/browser/src/_locales/es/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"message": "Bitwarden"
},
"extName": {
"message": "Bitwarden Password Manager",
"message": "Bitwarden - Administrador de contraseñas",
"description": "Extension name, MUST be less than 40 characters (Safari restriction)"
},
"extDesc": {
Expand Down Expand Up @@ -2962,27 +2962,27 @@
"description": "Label indicating the most common import formats"
},
"overrideDefaultBrowserAutofillTitle": {
"message": "¿Quiere hacer de Bitwarden su gestor de contraseñas predeterminado?",
"message": "¿Hacer de Bitwarden su administrador de contraseñas predeterminado?",
"description": "Dialog title facilitating the ability to override a chrome browser's default autofill behavior"
},
"overrideDefaultBrowserAutofillDescription": {
"message": "Pasar por alto esta opción puede causar conflictos entre el menú de relleno automático de Bitwarden y el del navegador.",
"message": "Pasar por alto esta opción puede causar conflictos entre el menú de autocompletar de Bitwarden y el de tu navegador.",
"description": "Dialog message facilitating the ability to override a chrome browser's default autofill behavior"
},
"overrideDefaultBrowserAutoFillSettings": {
"message": "Hacer de Bitwarden su gestor de contraseñas predeterminado",
"message": "Hacer de Bitwarden tu administrador de contraseñas predeterminado",
"description": "Label for the setting that allows overriding the default browser autofill settings"
},
"privacyPermissionAdditionNotGrantedTitle": {
"message": "No se pudo establecer Bitwarden como el gestor de contraseñas predeterminado",
"message": "No se puede establecer Bitwarden como el administrador de contraseñas predeterminado",
"description": "Title for the dialog that appears when the user has not granted the extension permission to set privacy settings"
},
"privacyPermissionAdditionNotGrantedDescription": {
"message": "Debe otorgar los permisos de privacidad del navegador a Bitwarden para establecerlo como gestor de contraseñas predeterminado.",
"message": "Debes otorgar permisos de privacidad del navegador a Bitwarden para establecerlo como administrador de contraseñas predeterminado.",
"description": "Description for the dialog that appears when the user has not granted the extension permission to set privacy settings"
},
"makeDefault": {
"message": "Predeterminar",
"message": "Establecer como predeterminado",
"description": "Button text for the setting that allows overriding the default browser autofill settings"
},
"saveCipherAttemptSuccess": {
Expand All @@ -2998,7 +2998,7 @@
"description": "Notification message for when saving credentials has failed."
},
"success": {
"message": "Success"
"message": "Éxito"
},
"removePasskey": {
"message": "Eliminar passkey"
Expand All @@ -3013,20 +3013,20 @@
"message": "Notice: On May 16, 2024, unassigned organization items will no longer be visible in the All Vaults view and will only be accessible via the Admin Console."
},
"unassignedItemsBannerCTAPartOne": {
"message": "Assign these items to a collection from the",
"message": "Asignar estos elementos a una colección de",
"description": "This will be part of a larger sentence, which will read like so: Assign these items to a collection from the Admin Console to make them visible."
},
"unassignedItemsBannerCTAPartTwo": {
"message": "to make them visible.",
"message": "para hcerlos visibles.",
"description": "This will be part of a larger sentence, which will read like so: Assign these items to a collection from the Admin Console to make them visible."
},
"adminConsole": {
"message": "Admin Console"
"message": "Consola de administrador"
},
"errorAssigningTargetCollection": {
"message": "Error assigning target collection."
"message": "Error al asignar la colección de destino."
},
"errorAssigningTargetFolder": {
"message": "Error assigning target folder."
"message": "Error al asignar la carpeta de destino."
}
}
20 changes: 10 additions & 10 deletions apps/browser/src/_locales/lt/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@
"message": "Keisti pagrindinį slaptažodį"
},
"continueToWebApp": {
"message": "Continue to web app?"
"message": "Tęsti į žiniatinklio programėlę?"
},
"changeMasterPasswordOnWebConfirmation": {
"message": "You can change your master password on the Bitwarden web app."
"message": "Pagrindinį slaptažodį galite pakeisti „Bitwarden“ žiniatinklio programėlėje."
},
"fingerprintPhrase": {
"message": "Pirštų atspaudų frazė",
Expand Down Expand Up @@ -2998,7 +2998,7 @@
"description": "Notification message for when saving credentials has failed."
},
"success": {
"message": "Success"
"message": "Sėkmė"
},
"removePasskey": {
"message": "Pašalinti slaptaraktį"
Expand All @@ -3007,26 +3007,26 @@
"message": "Pašalintas slaptaraktis"
},
"unassignedItemsBannerNotice": {
"message": "Notice: Unassigned organization items are no longer visible in the All Vaults view and only accessible via the Admin Console."
"message": "Pranešimas: nepriskirti organizacijos elementai nebėra matomi peržiūros rodinyje Visi saugyklos ir yra pasiekiami tik per Administratoriaus konsolę."
},
"unassignedItemsBannerSelfHostNotice": {
"message": "Notice: On May 16, 2024, unassigned organization items will no longer be visible in the All Vaults view and will only be accessible via the Admin Console."
"message": "Pranešimas: 2024 m. gegužės 16 d. nepriskirti organizacijos elementai nebėra matomi peržiūros rodinyje Visi saugyklos ir yra pasiekiami tik per Administratoriaus konsolę."
},
"unassignedItemsBannerCTAPartOne": {
"message": "Assign these items to a collection from the",
"message": "Priskirkite šiuos elementus kolekcijai iš",
"description": "This will be part of a larger sentence, which will read like so: Assign these items to a collection from the Admin Console to make them visible."
},
"unassignedItemsBannerCTAPartTwo": {
"message": "to make them visible.",
"message": ", kad jie būtų matomi.",
"description": "This will be part of a larger sentence, which will read like so: Assign these items to a collection from the Admin Console to make them visible."
},
"adminConsole": {
"message": "Admin Console"
"message": "Administratoriaus konsolės"
},
"errorAssigningTargetCollection": {
"message": "Error assigning target collection."
"message": "Klaida priskiriant tikslinę kolekciją."
},
"errorAssigningTargetFolder": {
"message": "Error assigning target folder."
"message": "Klaida priskiriant tikslinį aplanką."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
KeyGenerationServiceInitOptions,
keyGenerationServiceFactory,
} from "../../../platform/background/service-factories/key-generation-service.factory";
import { logServiceFactory } from "../../../platform/background/service-factories/log-service.factory";
import {
PlatformUtilsServiceInitOptions,
platformUtilsServiceFactory,
Expand Down Expand Up @@ -88,6 +89,7 @@ export function deviceTrustServiceFactory(
await stateProviderFactory(cache, opts),
await secureStorageServiceFactory(cache, opts),
await userDecryptionOptionsServiceFactory(cache, opts),
await logServiceFactory(cache, opts),
),
);
}
86 changes: 55 additions & 31 deletions apps/browser/src/background/main.background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Subject, firstValueFrom, map, merge, timeout } from "rxjs";
import { Subject, filter, firstValueFrom, map, merge, timeout } from "rxjs";

import {
PinCryptoServiceAbstraction,
Expand Down Expand Up @@ -631,6 +631,7 @@ export default class MainBackground {
this.stateProvider,
this.secureStorageService,
this.userDecryptionOptionsService,
this.logService,
);

this.devicesService = new DevicesServiceImplementation(this.devicesApiService);
Expand Down Expand Up @@ -1200,31 +1201,46 @@ export default class MainBackground {
}

async logout(expired: boolean, userId?: UserId) {
userId ??= (
await firstValueFrom(
this.accountService.activeAccount$.pipe(
timeout({
first: 2000,
with: () => {
throw new Error("No active account found to logout");
},
}),
),
)
)?.id;

await this.eventUploadService.uploadEvents(userId as UserId);
const activeUserId = await firstValueFrom(
this.accountService.activeAccount$.pipe(
map((a) => a?.id),
timeout({
first: 2000,
with: () => {
throw new Error("No active account found to logout");
},
}),
),
);

const userBeingLoggedOut = userId ?? activeUserId;

await this.eventUploadService.uploadEvents(userBeingLoggedOut);

// HACK: We shouldn't wait for the authentication status to change but instead subscribe to the
// authentication status to do various actions.
const logoutPromise = firstValueFrom(
this.authService.authStatusFor$(userBeingLoggedOut).pipe(
filter((authenticationStatus) => authenticationStatus === AuthenticationStatus.LoggedOut),
timeout({
first: 5_000,
with: () => {
throw new Error("The logout process did not complete in a reasonable amount of time.");
},
}),
),
);

await Promise.all([
this.syncService.setLastSync(new Date(0), userId),
this.cryptoService.clearKeys(userId),
this.cipherService.clear(userId),
this.folderService.clear(userId),
this.collectionService.clear(userId),
this.passwordGenerationService.clear(userId),
this.vaultTimeoutSettingsService.clear(userId),
this.syncService.setLastSync(new Date(0), userBeingLoggedOut),
this.cryptoService.clearKeys(userBeingLoggedOut),
this.cipherService.clear(userBeingLoggedOut),
this.folderService.clear(userBeingLoggedOut),
this.collectionService.clear(userBeingLoggedOut),
this.passwordGenerationService.clear(userBeingLoggedOut),
this.vaultTimeoutSettingsService.clear(userBeingLoggedOut),
this.vaultFilterService.clear(),
this.biometricStateService.logout(userId),
this.biometricStateService.logout(userBeingLoggedOut),
/* We intentionally do not clear:
* - autofillSettingsService
* - badgeSettingsService
Expand All @@ -1235,20 +1251,28 @@ export default class MainBackground {
//Needs to be checked before state is cleaned
const needStorageReseed = await this.needsStorageReseed();

const newActiveUser = await firstValueFrom(
this.accountService.nextUpAccount$.pipe(map((a) => a?.id)),
);
await this.stateService.clean({ userId: userId });
await this.accountService.clean(userId);
const newActiveUser =
userBeingLoggedOut === activeUserId
? await firstValueFrom(this.accountService.nextUpAccount$.pipe(map((a) => a?.id)))
: null;

await this.stateService.clean({ userId: userBeingLoggedOut });
await this.accountService.clean(userBeingLoggedOut);

await this.stateEventRunnerService.handleEvent("logout", userBeingLoggedOut);

await this.stateEventRunnerService.handleEvent("logout", userId);
// HACK: Wait for the user logging outs authentication status to transition to LoggedOut
await logoutPromise;

await this.switchAccount(newActiveUser);
if (newActiveUser != null) {
// we have a new active user, do not continue tearing down application
await this.switchAccount(newActiveUser as UserId);
this.messagingService.send("switchAccountFinish");
} else {
this.messagingService.send("doneLoggingOut", { expired: expired, userId: userId });
this.messagingService.send("doneLoggingOut", {
expired: expired,
userId: userBeingLoggedOut,
});
}

if (needStorageReseed) {
Expand Down

0 comments on commit bd3ee33

Please sign in to comment.