From 922de469f41b882dedb6d256af5be676c91907ba Mon Sep 17 00:00:00 2001 From: SmithThe4th Date: Wed, 4 Oct 2023 22:56:27 -0400 Subject: [PATCH 1/2] [PM-2169] Update Password Reprompt Modal to use Component Library (#5720) * update password reprompt to use the dialog CL * Override showPasswordPrompt and submit method on web child classes from base classes to allow dialog work on web and modal on other clients * Override showPasswordPrompt and submit method on web child classes from base classes to allow dialog work on web and modal on other clients * Fixed lint issues * Corrected comments * Refactored passwored reprompt to use dialog service after changes to make the dialog service work on the desktop and browser * Changed access modifier from protected to protected * Refactored passwprd reprompt component to a stand alone component and fixed all references * fix merge changes * fix import aliases in password-reprompt.component.ts * fix alias typo in browser tsconfig * import from root vault alias * revert tsconfig changes * remove service abstraction and update imports * remove component from imports * Removed unneccesary show password toggle * renamed selector to use vault prefix * removed unnecessary data dismiss * merged and fixed conflicts * remove reintroduced file * Added appAutoFocus to reprompt dialog * delayed validation until submit happens --------- Co-authored-by: William Martin --- apps/browser/src/popup/app.module.ts | 2 - .../src/popup/services/services.module.ts | 3 - .../components/action-buttons.component.ts | 2 +- .../password-reprompt.component.html | 55 --------------- .../components/password-reprompt.component.ts | 8 --- .../components/vault/add-edit.component.ts | 2 +- .../components/vault/current-tab.component.ts | 2 +- .../popup/components/vault/view.component.ts | 2 +- .../services/password-reprompt.service.ts | 10 --- apps/browser/tsconfig.json | 2 +- apps/desktop/src/app/app.module.ts | 2 - .../src/app/services/services.module.ts | 3 - .../password-reprompt.component.html | 57 ---------------- .../components/password-reprompt.component.ts | 8 --- .../src/vault/app/vault/add-edit.component.ts | 2 +- .../src/vault/app/vault/vault.component.ts | 2 +- .../src/vault/app/vault/view.component.ts | 2 +- .../services/password-reprompt.service.ts | 10 --- .../exposed-passwords-report.component.ts | 2 +- .../inactive-two-factor-report.component.ts | 2 +- .../reused-passwords-report.component.ts | 2 +- .../unsecured-websites-report.component.ts | 2 +- .../tools/weak-passwords-report.component.ts | 2 +- .../emergency-add-edit.component.ts | 2 +- apps/web/src/app/core/core.module.ts | 6 -- .../reports/pages/cipher-report.component.ts | 2 +- .../exposed-passwords-report.component.ts | 2 +- .../inactive-two-factor-report.component.ts | 2 +- .../reused-passwords-report.component.ts | 2 +- .../unsecured-websites-report.component.ts | 2 +- .../pages/weak-passwords-report.component.ts | 2 +- .../src/app/shared/loose-components.module.ts | 3 - .../password-reprompt.component.html | 53 --------------- .../components/password-reprompt.component.ts | 8 --- .../vault-cipher-row.component.html | 1 + .../vault-items/vault-cipher-row.component.ts | 2 +- .../vault/core/password-reprompt.service.ts | 10 --- .../individual-vault/add-edit.component.ts | 2 +- .../vault/individual-vault/vault.component.ts | 2 +- .../app/vault/org-vault/add-edit.component.ts | 2 +- .../app/vault/org-vault/vault.component.ts | 2 +- .../src/services/jslib-services.module.ts | 6 +- .../vault/components/add-edit.component.ts | 2 +- .../components/password-reprompt.component.ts | 42 ------------ .../src/vault/components/view.component.ts | 2 +- .../abstractions/password-reprompt.service.ts | 5 -- .../password-reprompt.component.html | 31 +++++++++ .../components/password-reprompt.component.ts | 68 +++++++++++++++++++ libs/vault/src/index.ts | 1 + .../password-reprompt.service.spec.ts | 11 ++- .../services/password-reprompt.service.ts | 19 +++--- 51 files changed, 144 insertions(+), 332 deletions(-) delete mode 100644 apps/browser/src/vault/popup/components/password-reprompt.component.html delete mode 100644 apps/browser/src/vault/popup/components/password-reprompt.component.ts delete mode 100644 apps/browser/src/vault/popup/services/password-reprompt.service.ts delete mode 100644 apps/desktop/src/vault/app/components/password-reprompt.component.html delete mode 100644 apps/desktop/src/vault/app/components/password-reprompt.component.ts delete mode 100644 apps/desktop/src/vault/services/password-reprompt.service.ts delete mode 100644 apps/web/src/app/vault/components/password-reprompt.component.html delete mode 100644 apps/web/src/app/vault/components/password-reprompt.component.ts delete mode 100644 apps/web/src/app/vault/core/password-reprompt.service.ts delete mode 100644 libs/angular/src/vault/components/password-reprompt.component.ts delete mode 100644 libs/common/src/vault/abstractions/password-reprompt.service.ts create mode 100644 libs/vault/src/components/password-reprompt.component.html create mode 100644 libs/vault/src/components/password-reprompt.component.ts rename libs/{angular/src/vault => vault/src}/services/password-reprompt.service.spec.ts (70%) rename libs/{angular/src/vault => vault/src}/services/password-reprompt.service.ts (61%) diff --git a/apps/browser/src/popup/app.module.ts b/apps/browser/src/popup/app.module.ts index 32eb7670f3c..9dbd87cff57 100644 --- a/apps/browser/src/popup/app.module.ts +++ b/apps/browser/src/popup/app.module.ts @@ -39,7 +39,6 @@ import { SendTypeComponent } from "../tools/popup/send/send-type.component"; import { ExportComponent } from "../tools/popup/settings/export.component"; import { ActionButtonsComponent } from "../vault/popup/components/action-buttons.component"; import { CipherRowComponent } from "../vault/popup/components/cipher-row.component"; -import { PasswordRepromptComponent } from "../vault/popup/components/password-reprompt.component"; import { AddEditCustomFieldsComponent } from "../vault/popup/components/vault/add-edit-custom-fields.component"; import { AddEditComponent } from "../vault/popup/components/vault/add-edit.component"; import { AttachmentsComponent } from "../vault/popup/components/vault/attachments.component"; @@ -125,7 +124,6 @@ import "../platform/popup/locales"; GeneratorComponent, PasswordGeneratorHistoryComponent, PasswordHistoryComponent, - PasswordRepromptComponent, PopOutComponent, PremiumComponent, PrivateModeWarningComponent, diff --git a/apps/browser/src/popup/services/services.module.ts b/apps/browser/src/popup/services/services.module.ts index c0597e29e44..6770e152504 100644 --- a/apps/browser/src/popup/services/services.module.ts +++ b/apps/browser/src/popup/services/services.module.ts @@ -80,7 +80,6 @@ import { FolderService, InternalFolderService, } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { FolderApiService } from "@bitwarden/common/vault/services/folder/folder-api.service"; import { DialogService } from "@bitwarden/components"; @@ -104,7 +103,6 @@ import BrowserMessagingService from "../../platform/services/browser-messaging.s import { BrowserStateService } from "../../platform/services/browser-state.service"; import { BrowserSendService } from "../../services/browser-send.service"; import { BrowserSettingsService } from "../../services/browser-settings.service"; -import { PasswordRepromptService } from "../../vault/popup/services/password-reprompt.service"; import { BrowserFolderService } from "../../vault/services/browser-folder.service"; import { VaultFilterService } from "../../vault/services/vault-filter.service"; @@ -409,7 +407,6 @@ function getBgService(service: keyof MainBackground) { useFactory: getBgService("logService"), deps: [], }, - { provide: PasswordRepromptServiceAbstraction, useClass: PasswordRepromptService }, { provide: OrganizationService, useFactory: (stateService: StateServiceAbstraction) => { diff --git a/apps/browser/src/vault/popup/components/action-buttons.component.ts b/apps/browser/src/vault/popup/components/action-buttons.component.ts index 110e4ef32a5..ff8b7cab0d1 100644 --- a/apps/browser/src/vault/popup/components/action-buttons.component.ts +++ b/apps/browser/src/vault/popup/components/action-buttons.component.ts @@ -6,10 +6,10 @@ import { EventType } from "@bitwarden/common/enums"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; @Component({ selector: "app-action-buttons", diff --git a/apps/browser/src/vault/popup/components/password-reprompt.component.html b/apps/browser/src/vault/popup/components/password-reprompt.component.html deleted file mode 100644 index 730e96fab96..00000000000 --- a/apps/browser/src/vault/popup/components/password-reprompt.component.html +++ /dev/null @@ -1,55 +0,0 @@ - diff --git a/apps/browser/src/vault/popup/components/password-reprompt.component.ts b/apps/browser/src/vault/popup/components/password-reprompt.component.ts deleted file mode 100644 index f63da5ed48e..00000000000 --- a/apps/browser/src/vault/popup/components/password-reprompt.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from "@angular/core"; - -import { PasswordRepromptComponent as BasePasswordRepromptComponent } from "@bitwarden/angular/vault/components/password-reprompt.component"; - -@Component({ - templateUrl: "password-reprompt.component.html", -}) -export class PasswordRepromptComponent extends BasePasswordRepromptComponent {} diff --git a/apps/browser/src/vault/popup/components/vault/add-edit.component.ts b/apps/browser/src/vault/popup/components/vault/add-edit.component.ts index f4e9fad5634..fd75b2e8c58 100644 --- a/apps/browser/src/vault/popup/components/vault/add-edit.component.ts +++ b/apps/browser/src/vault/popup/components/vault/add-edit.component.ts @@ -17,10 +17,10 @@ import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.s import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { BrowserApi } from "../../../../platform/browser/browser-api"; import { PopupUtilsService } from "../../../../popup/services/popup-utils.service"; diff --git a/apps/browser/src/vault/popup/components/vault/current-tab.component.ts b/apps/browser/src/vault/popup/components/vault/current-tab.component.ts index 4b2c62a0e0d..4f1ceb466de 100644 --- a/apps/browser/src/vault/popup/components/vault/current-tab.component.ts +++ b/apps/browser/src/vault/popup/components/vault/current-tab.component.ts @@ -11,11 +11,11 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { AutofillService } from "../../../../autofill/services/abstractions/autofill.service"; import { BrowserApi } from "../../../../platform/browser/browser-api"; diff --git a/apps/browser/src/vault/popup/components/vault/view.component.ts b/apps/browser/src/vault/popup/components/vault/view.component.ts index 19c37fc985e..6c9f3967d56 100644 --- a/apps/browser/src/vault/popup/components/vault/view.component.ts +++ b/apps/browser/src/vault/popup/components/vault/view.component.ts @@ -20,11 +20,11 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { AutofillService } from "../../../../autofill/services/abstractions/autofill.service"; import { BrowserApi } from "../../../../platform/browser/browser-api"; diff --git a/apps/browser/src/vault/popup/services/password-reprompt.service.ts b/apps/browser/src/vault/popup/services/password-reprompt.service.ts deleted file mode 100644 index 22bbcf44d7f..00000000000 --- a/apps/browser/src/vault/popup/services/password-reprompt.service.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Injectable } from "@angular/core"; - -import { PasswordRepromptService as BasePasswordRepromptService } from "@bitwarden/angular/vault/services/password-reprompt.service"; - -import { PasswordRepromptComponent } from "../components/password-reprompt.component"; - -@Injectable() -export class PasswordRepromptService extends BasePasswordRepromptService { - component = PasswordRepromptComponent; -} diff --git a/apps/browser/tsconfig.json b/apps/browser/tsconfig.json index ecb2f996e55..357be6c5281 100644 --- a/apps/browser/tsconfig.json +++ b/apps/browser/tsconfig.json @@ -16,7 +16,7 @@ "@bitwarden/components": ["../../libs/components/src"], "@bitwarden/exporter/*": ["../../libs/exporter/src/*"], "@bitwarden/importer": ["../../libs/importer/src"], - "@bitwarden/vault": ["../../libs/auth/src"] + "@bitwarden/vault": ["../../libs/vault/src"] }, "useDefineForClassFields": false }, diff --git a/apps/desktop/src/app/app.module.ts b/apps/desktop/src/app/app.module.ts index d14c40854cc..172447822c9 100644 --- a/apps/desktop/src/app/app.module.ts +++ b/apps/desktop/src/app/app.module.ts @@ -24,7 +24,6 @@ import { TwoFactorOptionsComponent } from "../auth/two-factor-options.component" import { TwoFactorComponent } from "../auth/two-factor.component"; import { UpdateTempPasswordComponent } from "../auth/update-temp-password.component"; import { PremiumComponent } from "../vault/app/accounts/premium.component"; -import { PasswordRepromptComponent } from "../vault/app/components/password-reprompt.component"; import { AddEditCustomFieldsComponent } from "../vault/app/vault/add-edit-custom-fields.component"; import { AddEditComponent } from "../vault/app/vault/add-edit.component"; import { AttachmentsComponent } from "../vault/app/vault/attachments.component"; @@ -79,7 +78,6 @@ import { SendComponent } from "./tools/send/send.component"; GeneratorComponent, PasswordGeneratorHistoryComponent, PasswordHistoryComponent, - PasswordRepromptComponent, PremiumComponent, RegisterComponent, RemovePasswordComponent, diff --git a/apps/desktop/src/app/services/services.module.ts b/apps/desktop/src/app/services/services.module.ts index c6fd0049901..f4841073c9c 100644 --- a/apps/desktop/src/app/services/services.module.ts +++ b/apps/desktop/src/app/services/services.module.ts @@ -35,7 +35,6 @@ import { MemoryStorageService } from "@bitwarden/common/platform/services/memory import { SystemService } from "@bitwarden/common/platform/services/system.service"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { CipherService as CipherServiceAbstraction } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { DialogService } from "@bitwarden/components"; import { LoginGuard } from "../../auth/guards/login.guard"; @@ -52,7 +51,6 @@ import { I18nService } from "../../platform/services/i18n.service"; import { EncryptedMessageHandlerService } from "../../services/encrypted-message-handler.service"; import { NativeMessageHandlerService } from "../../services/native-message-handler.service"; import { NativeMessagingService } from "../../services/native-messaging.service"; -import { PasswordRepromptService } from "../../vault/services/password-reprompt.service"; import { SearchBarService } from "../layout/search/search-bar.service"; import { DesktopFileDownloadService } from "./desktop-file-download.service"; @@ -113,7 +111,6 @@ const RELOAD_CALLBACK = new InjectionToken<() => any>("RELOAD_CALLBACK"); StateServiceAbstraction, ], }, - { provide: PasswordRepromptServiceAbstraction, useClass: PasswordRepromptService }, { provide: StateServiceAbstraction, useClass: ElectronStateService, diff --git a/apps/desktop/src/vault/app/components/password-reprompt.component.html b/apps/desktop/src/vault/app/components/password-reprompt.component.html deleted file mode 100644 index 1ff853c278c..00000000000 --- a/apps/desktop/src/vault/app/components/password-reprompt.component.html +++ /dev/null @@ -1,57 +0,0 @@ - diff --git a/apps/desktop/src/vault/app/components/password-reprompt.component.ts b/apps/desktop/src/vault/app/components/password-reprompt.component.ts deleted file mode 100644 index f63da5ed48e..00000000000 --- a/apps/desktop/src/vault/app/components/password-reprompt.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from "@angular/core"; - -import { PasswordRepromptComponent as BasePasswordRepromptComponent } from "@bitwarden/angular/vault/components/password-reprompt.component"; - -@Component({ - templateUrl: "password-reprompt.component.html", -}) -export class PasswordRepromptComponent extends BasePasswordRepromptComponent {} diff --git a/apps/desktop/src/vault/app/vault/add-edit.component.ts b/apps/desktop/src/vault/app/vault/add-edit.component.ts index 8a90d6a7e1a..00ae8022b16 100644 --- a/apps/desktop/src/vault/app/vault/add-edit.component.ts +++ b/apps/desktop/src/vault/app/vault/add-edit.component.ts @@ -16,8 +16,8 @@ import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.s import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; const BroadcasterSubscriptionId = "AddEditComponent"; diff --git a/apps/desktop/src/vault/app/vault/vault.component.ts b/apps/desktop/src/vault/app/vault/vault.component.ts index 0b419b5088f..7930663499d 100644 --- a/apps/desktop/src/vault/app/vault/vault.component.ts +++ b/apps/desktop/src/vault/app/vault/vault.component.ts @@ -22,13 +22,13 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { FolderView } from "@bitwarden/common/vault/models/view/folder.view"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { SearchBarService } from "../../../app/layout/search/search-bar.service"; import { GeneratorComponent } from "../../../app/tools/generator.component"; diff --git a/apps/desktop/src/vault/app/vault/view.component.ts b/apps/desktop/src/vault/app/vault/view.component.ts index b6bf63d6e64..adb72dbfe33 100644 --- a/apps/desktop/src/vault/app/vault/view.component.ts +++ b/apps/desktop/src/vault/app/vault/view.component.ts @@ -23,9 +23,9 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; const BroadcasterSubscriptionId = "ViewComponent"; diff --git a/apps/desktop/src/vault/services/password-reprompt.service.ts b/apps/desktop/src/vault/services/password-reprompt.service.ts deleted file mode 100644 index ebff838d5ca..00000000000 --- a/apps/desktop/src/vault/services/password-reprompt.service.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Injectable } from "@angular/core"; - -import { PasswordRepromptService as BasePasswordRepromptService } from "@bitwarden/angular/vault/services/password-reprompt.service"; - -import { PasswordRepromptComponent } from "../app/components/password-reprompt.component"; - -@Injectable() -export class PasswordRepromptService extends BasePasswordRepromptService { - component = PasswordRepromptComponent; -} diff --git a/apps/web/src/app/admin-console/organizations/tools/exposed-passwords-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/exposed-passwords-report.component.ts index cf721098a2c..415bd6516c2 100644 --- a/apps/web/src/app/admin-console/organizations/tools/exposed-passwords-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/exposed-passwords-report.component.ts @@ -6,9 +6,9 @@ import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; // eslint-disable-next-line no-restricted-imports import { ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent } from "../../../reports/pages/exposed-passwords-report.component"; diff --git a/apps/web/src/app/admin-console/organizations/tools/inactive-two-factor-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/inactive-two-factor-report.component.ts index 9d62073e066..4cc68b1f9d0 100644 --- a/apps/web/src/app/admin-console/organizations/tools/inactive-two-factor-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/inactive-two-factor-report.component.ts @@ -6,8 +6,8 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; // eslint-disable-next-line no-restricted-imports import { InactiveTwoFactorReportComponent as BaseInactiveTwoFactorReportComponent } from "../../../reports/pages/inactive-two-factor-report.component"; diff --git a/apps/web/src/app/admin-console/organizations/tools/reused-passwords-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/reused-passwords-report.component.ts index b410b63e0ff..93652239a11 100644 --- a/apps/web/src/app/admin-console/organizations/tools/reused-passwords-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/reused-passwords-report.component.ts @@ -6,9 +6,9 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; // eslint-disable-next-line no-restricted-imports import { ReusedPasswordsReportComponent as BaseReusedPasswordsReportComponent } from "../../../reports/pages/reused-passwords-report.component"; diff --git a/apps/web/src/app/admin-console/organizations/tools/unsecured-websites-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/unsecured-websites-report.component.ts index 53ce0304507..e8fbc0ed5e6 100644 --- a/apps/web/src/app/admin-console/organizations/tools/unsecured-websites-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/unsecured-websites-report.component.ts @@ -5,8 +5,8 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; // eslint-disable-next-line no-restricted-imports import { UnsecuredWebsitesReportComponent as BaseUnsecuredWebsitesReportComponent } from "../../../reports/pages/unsecured-websites-report.component"; diff --git a/apps/web/src/app/admin-console/organizations/tools/weak-passwords-report.component.ts b/apps/web/src/app/admin-console/organizations/tools/weak-passwords-report.component.ts index 68619b27514..540f71d91dc 100644 --- a/apps/web/src/app/admin-console/organizations/tools/weak-passwords-report.component.ts +++ b/apps/web/src/app/admin-console/organizations/tools/weak-passwords-report.component.ts @@ -6,9 +6,9 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; // eslint-disable-next-line no-restricted-imports import { WeakPasswordsReportComponent as BaseWeakPasswordsReportComponent } from "../../../reports/pages/weak-passwords-report.component"; diff --git a/apps/web/src/app/auth/settings/emergency-access/emergency-add-edit.component.ts b/apps/web/src/app/auth/settings/emergency-access/emergency-add-edit.component.ts index 925ebbf3ea6..fdb72518b19 100644 --- a/apps/web/src/app/auth/settings/emergency-access/emergency-add-edit.component.ts +++ b/apps/web/src/app/auth/settings/emergency-access/emergency-add-edit.component.ts @@ -15,9 +15,9 @@ import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.s import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { AddEditComponent as BaseAddEditComponent } from "../../../vault/individual-vault/add-edit.component"; diff --git a/apps/web/src/app/core/core.module.ts b/apps/web/src/app/core/core.module.ts index b2e44d7e3db..4df6557fac5 100644 --- a/apps/web/src/app/core/core.module.ts +++ b/apps/web/src/app/core/core.module.ts @@ -21,13 +21,11 @@ import { StateService as BaseStateServiceAbstraction } from "@bitwarden/common/p import { AbstractStorageService } from "@bitwarden/common/platform/abstractions/storage.service"; import { StateFactory } from "@bitwarden/common/platform/factories/state-factory"; import { MemoryStorageService } from "@bitwarden/common/platform/services/memory-storage.service"; -import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { PolicyListService } from "../admin-console/core/policy-list.service"; import { HtmlStorageService } from "../core/html-storage.service"; import { I18nService } from "../core/i18n.service"; import { CollectionAdminService } from "../vault/core/collection-admin.service"; -import { PasswordRepromptService } from "../vault/core/password-reprompt.service"; import { BroadcasterMessagingService } from "./broadcaster-messaging.service"; import { EventService } from "./event.service"; @@ -87,10 +85,6 @@ import { WebPlatformUtilsService } from "./web-platform-utils.service"; provide: BaseStateServiceAbstraction, useExisting: StateService, }, - { - provide: PasswordRepromptServiceAbstraction, - useClass: PasswordRepromptService, - }, { provide: FileDownloadService, useClass: WebFileDownloadService, diff --git a/apps/web/src/app/reports/pages/cipher-report.component.ts b/apps/web/src/app/reports/pages/cipher-report.component.ts index c6af91fb962..80c41b0c252 100644 --- a/apps/web/src/app/reports/pages/cipher-report.component.ts +++ b/apps/web/src/app/reports/pages/cipher-report.component.ts @@ -3,9 +3,9 @@ import { Directive, ViewChild, ViewContainerRef } from "@angular/core"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { AddEditComponent } from "../../vault/individual-vault/add-edit.component"; import { AddEditComponent as OrgAddEditComponent } from "../../vault/org-vault/add-edit.component"; diff --git a/apps/web/src/app/reports/pages/exposed-passwords-report.component.ts b/apps/web/src/app/reports/pages/exposed-passwords-report.component.ts index 38b18dae160..dec2f707d4a 100644 --- a/apps/web/src/app/reports/pages/exposed-passwords-report.component.ts +++ b/apps/web/src/app/reports/pages/exposed-passwords-report.component.ts @@ -4,9 +4,9 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { AuditService } from "@bitwarden/common/abstractions/audit.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { CipherReportComponent } from "./cipher-report.component"; diff --git a/apps/web/src/app/reports/pages/inactive-two-factor-report.component.ts b/apps/web/src/app/reports/pages/inactive-two-factor-report.component.ts index a70ede0102e..ad257d7e596 100644 --- a/apps/web/src/app/reports/pages/inactive-two-factor-report.component.ts +++ b/apps/web/src/app/reports/pages/inactive-two-factor-report.component.ts @@ -5,9 +5,9 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service" import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { CipherReportComponent } from "./cipher-report.component"; diff --git a/apps/web/src/app/reports/pages/reused-passwords-report.component.ts b/apps/web/src/app/reports/pages/reused-passwords-report.component.ts index 95851eca1b7..431b571fa16 100644 --- a/apps/web/src/app/reports/pages/reused-passwords-report.component.ts +++ b/apps/web/src/app/reports/pages/reused-passwords-report.component.ts @@ -4,9 +4,9 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { CipherReportComponent } from "./cipher-report.component"; diff --git a/apps/web/src/app/reports/pages/unsecured-websites-report.component.ts b/apps/web/src/app/reports/pages/unsecured-websites-report.component.ts index 14bc961e347..42ddb3b1d5d 100644 --- a/apps/web/src/app/reports/pages/unsecured-websites-report.component.ts +++ b/apps/web/src/app/reports/pages/unsecured-websites-report.component.ts @@ -3,9 +3,9 @@ import { Component, OnInit } from "@angular/core"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { CipherReportComponent } from "./cipher-report.component"; diff --git a/apps/web/src/app/reports/pages/weak-passwords-report.component.ts b/apps/web/src/app/reports/pages/weak-passwords-report.component.ts index ddea66a6a91..b5bad708afd 100644 --- a/apps/web/src/app/reports/pages/weak-passwords-report.component.ts +++ b/apps/web/src/app/reports/pages/weak-passwords-report.component.ts @@ -4,10 +4,10 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { BadgeTypes } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { CipherReportComponent } from "./cipher-report.component"; diff --git a/apps/web/src/app/shared/loose-components.module.ts b/apps/web/src/app/shared/loose-components.module.ts index 08f14a5cce9..86c0da0d908 100644 --- a/apps/web/src/app/shared/loose-components.module.ts +++ b/apps/web/src/app/shared/loose-components.module.ts @@ -79,7 +79,6 @@ import { PasswordGeneratorHistoryComponent } from "../tools/password-generator-h import { AccessComponent } from "../tools/send/access.component"; import { AddEditComponent as SendAddEditComponent } from "../tools/send/add-edit.component"; import { ToolsComponent } from "../tools/tools.component"; -import { PasswordRepromptComponent } from "../vault/components/password-reprompt.component"; import { PremiumBadgeComponent } from "../vault/components/premium-badge.component"; import { AddEditCustomFieldsComponent } from "../vault/individual-vault/add-edit-custom-fields.component"; import { AddEditComponent } from "../vault/individual-vault/add-edit.component"; @@ -159,7 +158,6 @@ import { SharedModule } from "./shared.module"; OrgWeakPasswordsReportComponent, GeneratorComponent, PasswordGeneratorHistoryComponent, - PasswordRepromptComponent, PreferencesComponent, PremiumBadgeComponent, ProfileComponent, @@ -246,7 +244,6 @@ import { SharedModule } from "./shared.module"; OrgWeakPasswordsReportComponent, GeneratorComponent, PasswordGeneratorHistoryComponent, - PasswordRepromptComponent, PreferencesComponent, PremiumBadgeComponent, ProfileComponent, diff --git a/apps/web/src/app/vault/components/password-reprompt.component.html b/apps/web/src/app/vault/components/password-reprompt.component.html deleted file mode 100644 index ebd81976566..00000000000 --- a/apps/web/src/app/vault/components/password-reprompt.component.html +++ /dev/null @@ -1,53 +0,0 @@ - diff --git a/apps/web/src/app/vault/components/password-reprompt.component.ts b/apps/web/src/app/vault/components/password-reprompt.component.ts deleted file mode 100644 index f63da5ed48e..00000000000 --- a/apps/web/src/app/vault/components/password-reprompt.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from "@angular/core"; - -import { PasswordRepromptComponent as BasePasswordRepromptComponent } from "@bitwarden/angular/vault/components/password-reprompt.component"; - -@Component({ - templateUrl: "password-reprompt.component.html", -}) -export class PasswordRepromptComponent extends BasePasswordRepromptComponent {} diff --git a/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.html b/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.html index 07d061311cf..934062fa699 100644 --- a/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.html +++ b/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.html @@ -22,6 +22,7 @@ queryParamsHandling="merge" title="{{ 'editItemWithName' | i18n : cipher.name }}" type="button" + appStopProp > {{ cipher.name }} diff --git a/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.ts b/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.ts index 7bd9677c759..7c70a797437 100644 --- a/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.ts +++ b/apps/web/src/app/vault/components/vault-items/vault-cipher-row.component.ts @@ -55,7 +55,7 @@ export class VaultCipherRowComponent { @HostListener("click") protected click() { this.router.navigate([], { - queryParams: { cipherId: this.cipher.id }, + queryParams: { itemId: this.cipher.id }, queryParamsHandling: "merge", }); } diff --git a/apps/web/src/app/vault/core/password-reprompt.service.ts b/apps/web/src/app/vault/core/password-reprompt.service.ts deleted file mode 100644 index 22bbcf44d7f..00000000000 --- a/apps/web/src/app/vault/core/password-reprompt.service.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Injectable } from "@angular/core"; - -import { PasswordRepromptService as BasePasswordRepromptService } from "@bitwarden/angular/vault/services/password-reprompt.service"; - -import { PasswordRepromptComponent } from "../components/password-reprompt.component"; - -@Injectable() -export class PasswordRepromptService extends BasePasswordRepromptService { - component = PasswordRepromptComponent; -} diff --git a/apps/web/src/app/vault/individual-vault/add-edit.component.ts b/apps/web/src/app/vault/individual-vault/add-edit.component.ts index 61dd6124b41..74e7a9e6e30 100644 --- a/apps/web/src/app/vault/individual-vault/add-edit.component.ts +++ b/apps/web/src/app/vault/individual-vault/add-edit.component.ts @@ -17,10 +17,10 @@ import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.s import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; @Component({ selector: "app-vault-add-edit", diff --git a/apps/web/src/app/vault/individual-vault/vault.component.ts b/apps/web/src/app/vault/individual-vault/vault.component.ts index 69cc909cab7..3b8d60d263b 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault.component.ts @@ -52,7 +52,6 @@ import { StateService } from "@bitwarden/common/platform/abstractions/state.serv import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CollectionData } from "@bitwarden/common/vault/models/data/collection.data"; @@ -60,6 +59,7 @@ import { CollectionDetailsResponse } from "@bitwarden/common/vault/models/respon import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; import { DialogService, Icons } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { CollectionDialogAction, diff --git a/apps/web/src/app/vault/org-vault/add-edit.component.ts b/apps/web/src/app/vault/org-vault/add-edit.component.ts index bea55856a4a..c8a37c087ad 100644 --- a/apps/web/src/app/vault/org-vault/add-edit.component.ts +++ b/apps/web/src/app/vault/org-vault/add-edit.component.ts @@ -16,10 +16,10 @@ import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.s import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherData } from "@bitwarden/common/vault/models/data/cipher.data"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { AddEditComponent as BaseAddEditComponent } from "../individual-vault/add-edit.component"; diff --git a/apps/web/src/app/vault/org-vault/vault.component.ts b/apps/web/src/app/vault/org-vault/vault.component.ts index 48f927e4d01..dcdd73da3c4 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.ts +++ b/apps/web/src/app/vault/org-vault/vault.component.ts @@ -47,12 +47,12 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { Utils } from "@bitwarden/common/platform/misc/utils"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view"; import { DialogService, Icons } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { GroupService, GroupView } from "../../admin-console/organizations/core"; import { openEntityEventsDialog } from "../../admin-console/organizations/manage/entity-events.component"; diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index bbea250bcdf..e2019c7d33f 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -136,7 +136,6 @@ import { FolderService as FolderServiceAbstraction, InternalFolderService, } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { SyncNotifierService as SyncNotifierServiceAbstraction } from "@bitwarden/common/vault/abstractions/sync/sync-notifier.service.abstraction"; import { SyncService as SyncServiceAbstraction } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; import { CipherService } from "@bitwarden/common/vault/services/cipher.service"; @@ -156,13 +155,13 @@ import { ImportService, ImportServiceAbstraction, } from "@bitwarden/importer"; +import { PasswordRepromptService } from "@bitwarden/vault"; import { AuthGuard } from "../auth/guards/auth.guard"; import { UnauthGuard } from "../auth/guards/unauth.guard"; import { FormValidationErrorsService as FormValidationErrorsServiceAbstraction } from "../platform/abstractions/form-validation-errors.service"; import { BroadcasterService } from "../platform/services/broadcaster.service"; import { FormValidationErrorsService } from "../platform/services/form-validation-errors.service"; -import { PasswordRepromptService } from "../vault/services/password-reprompt.service"; import { LOCALES_DIRECTORY, @@ -186,6 +185,8 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction"; AuthGuard, UnauthGuard, ModalService, + PasswordRepromptService, + { provide: WINDOW, useValue: window }, { provide: LOCALE_ID, @@ -603,7 +604,6 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction"; UserVerificationApiServiceAbstraction, ], }, - { provide: PasswordRepromptServiceAbstraction, useClass: PasswordRepromptService }, { provide: OrganizationServiceAbstraction, useClass: OrganizationService, diff --git a/libs/angular/src/vault/components/add-edit.component.ts b/libs/angular/src/vault/components/add-edit.component.ts index 3aca51e44a8..fb065587bf9 100644 --- a/libs/angular/src/vault/components/add-edit.component.ts +++ b/libs/angular/src/vault/components/add-edit.component.ts @@ -21,7 +21,6 @@ import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.s import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { Cipher } from "@bitwarden/common/vault/models/domain/cipher"; @@ -34,6 +33,7 @@ import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view import { LoginView } from "@bitwarden/common/vault/models/view/login.view"; import { SecureNoteView } from "@bitwarden/common/vault/models/view/secure-note.view"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; @Directive() export class AddEditComponent implements OnInit, OnDestroy { diff --git a/libs/angular/src/vault/components/password-reprompt.component.ts b/libs/angular/src/vault/components/password-reprompt.component.ts deleted file mode 100644 index 1094b379316..00000000000 --- a/libs/angular/src/vault/components/password-reprompt.component.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Directive } from "@angular/core"; - -import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; - -import { ModalRef } from "../../components/modal/modal.ref"; - -/** - * Used to verify the user's Master Password for the "Master Password Re-prompt" feature only. - * See UserVerificationComponent for any other situation where you need to verify the user's identity. - */ -@Directive() -export class PasswordRepromptComponent { - showPassword = false; - masterPassword = ""; - - constructor( - private modalRef: ModalRef, - private cryptoService: CryptoService, - private platformUtilsService: PlatformUtilsService, - private i18nService: I18nService - ) {} - - togglePassword() { - this.showPassword = !this.showPassword; - } - - async submit() { - const storedMasterKey = await this.cryptoService.getOrDeriveMasterKey(this.masterPassword); - if (!(await this.cryptoService.compareAndUpdateKeyHash(this.masterPassword, storedMasterKey))) { - this.platformUtilsService.showToast( - "error", - this.i18nService.t("errorOccurred"), - this.i18nService.t("invalidMasterPassword") - ); - return; - } - - this.modalRef.close(true); - } -} diff --git a/libs/angular/src/vault/components/view.component.ts b/libs/angular/src/vault/components/view.component.ts index 40523afd850..781034aa9f3 100644 --- a/libs/angular/src/vault/components/view.component.ts +++ b/libs/angular/src/vault/components/view.component.ts @@ -27,7 +27,6 @@ import { StateService } from "@bitwarden/common/platform/abstractions/state.serv import { EncArrayBuffer } from "@bitwarden/common/platform/models/domain/enc-array-buffer"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { FolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; -import { PasswordRepromptService } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; import { CipherRepromptType } from "@bitwarden/common/vault/enums/cipher-reprompt-type"; import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.view"; @@ -35,6 +34,7 @@ import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { FolderView } from "@bitwarden/common/vault/models/view/folder.view"; import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view"; import { DialogService } from "@bitwarden/components"; +import { PasswordRepromptService } from "@bitwarden/vault"; const BroadcasterSubscriptionId = "ViewComponent"; diff --git a/libs/common/src/vault/abstractions/password-reprompt.service.ts b/libs/common/src/vault/abstractions/password-reprompt.service.ts deleted file mode 100644 index 6253425b34d..00000000000 --- a/libs/common/src/vault/abstractions/password-reprompt.service.ts +++ /dev/null @@ -1,5 +0,0 @@ -export abstract class PasswordRepromptService { - protectedFields: () => string[]; - showPasswordPrompt: () => Promise; - enabled: () => Promise; -} diff --git a/libs/vault/src/components/password-reprompt.component.html b/libs/vault/src/components/password-reprompt.component.html new file mode 100644 index 00000000000..4ee1c16238d --- /dev/null +++ b/libs/vault/src/components/password-reprompt.component.html @@ -0,0 +1,31 @@ +
+ + + {{ "passwordConfirmation" | i18n }} + + + {{ "passwordConfirmationDesc" | i18n }} + + + {{ "masterPass" | i18n }} + + + + + + + + + + +
diff --git a/libs/vault/src/components/password-reprompt.component.ts b/libs/vault/src/components/password-reprompt.component.ts new file mode 100644 index 00000000000..fd8da6c574a --- /dev/null +++ b/libs/vault/src/components/password-reprompt.component.ts @@ -0,0 +1,68 @@ +import { DialogRef } from "@angular/cdk/dialog"; +import { Component } from "@angular/core"; +import { FormBuilder, ReactiveFormsModule, Validators } from "@angular/forms"; + +import { JslibModule } from "@bitwarden/angular/jslib.module"; +import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; +import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; +import { + AsyncActionsModule, + ButtonModule, + DialogModule, + FormFieldModule, + IconButtonModule, +} from "@bitwarden/components"; + +/** + * Used to verify the user's Master Password for the "Master Password Re-prompt" feature only. + * See UserVerificationComponent for any other situation where you need to verify the user's identity. + */ +@Component({ + standalone: true, + selector: "vault-password-reprompt", + imports: [ + JslibModule, + AsyncActionsModule, + ButtonModule, + DialogModule, + FormFieldModule, + IconButtonModule, + ReactiveFormsModule, + ], + templateUrl: "password-reprompt.component.html", +}) +export class PasswordRepromptComponent { + formGroup = this.formBuilder.group({ + masterPassword: ["", { validators: [Validators.required], updateOn: "submit" }], + }); + + constructor( + protected cryptoService: CryptoService, + protected platformUtilsService: PlatformUtilsService, + protected i18nService: I18nService, + protected formBuilder: FormBuilder, + protected dialogRef: DialogRef + ) {} + + submit = async () => { + const storedMasterKey = await this.cryptoService.getOrDeriveMasterKey( + this.formGroup.value.masterPassword + ); + if ( + !(await this.cryptoService.compareAndUpdateKeyHash( + this.formGroup.value.masterPassword, + storedMasterKey + )) + ) { + this.platformUtilsService.showToast( + "error", + this.i18nService.t("errorOccurred"), + this.i18nService.t("invalidMasterPassword") + ); + return; + } + + this.dialogRef.close(true); + }; +} diff --git a/libs/vault/src/index.ts b/libs/vault/src/index.ts index e69de29bb2d..bf6b7f91c23 100644 --- a/libs/vault/src/index.ts +++ b/libs/vault/src/index.ts @@ -0,0 +1 @@ +export { PasswordRepromptService } from "./services/password-reprompt.service"; diff --git a/libs/angular/src/vault/services/password-reprompt.service.spec.ts b/libs/vault/src/services/password-reprompt.service.spec.ts similarity index 70% rename from libs/angular/src/vault/services/password-reprompt.service.spec.ts rename to libs/vault/src/services/password-reprompt.service.spec.ts index f2fb64bac3a..300b98215c2 100644 --- a/libs/angular/src/vault/services/password-reprompt.service.spec.ts +++ b/libs/vault/src/services/password-reprompt.service.spec.ts @@ -1,8 +1,7 @@ import { MockProxy, mock } from "jest-mock-extended"; -import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; - -import { ModalService } from "../../services/modal.service"; +import { UserVerificationService } from "@bitwarden/common/src/auth/abstractions/user-verification/user-verification.service.abstraction"; +import { DialogService } from "@bitwarden/components"; import { PasswordRepromptService } from "./password-reprompt.service"; @@ -10,13 +9,13 @@ describe("PasswordRepromptService", () => { let passwordRepromptService: PasswordRepromptService; let userVerificationService: MockProxy; - let modalService: MockProxy; + let dialogService: MockProxy; beforeEach(() => { - modalService = mock(); + dialogService = mock(); userVerificationService = mock(); - passwordRepromptService = new PasswordRepromptService(modalService, userVerificationService); + passwordRepromptService = new PasswordRepromptService(dialogService, userVerificationService); }); describe("enabled()", () => { diff --git a/libs/angular/src/vault/services/password-reprompt.service.ts b/libs/vault/src/services/password-reprompt.service.ts similarity index 61% rename from libs/angular/src/vault/services/password-reprompt.service.ts rename to libs/vault/src/services/password-reprompt.service.ts index 7a06771a456..4b4a7a65f67 100644 --- a/libs/angular/src/vault/services/password-reprompt.service.ts +++ b/libs/vault/src/services/password-reprompt.service.ts @@ -1,9 +1,9 @@ import { Injectable } from "@angular/core"; +import { lastValueFrom } from "rxjs"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; -import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/vault/abstractions/password-reprompt.service"; +import { DialogService } from "@bitwarden/components"; -import { ModalService } from "../../services/modal.service"; import { PasswordRepromptComponent } from "../components/password-reprompt.component"; /** @@ -11,11 +11,9 @@ import { PasswordRepromptComponent } from "../components/password-reprompt.compo * See UserVerificationService for any other situation where you need to verify the user's identity. */ @Injectable() -export class PasswordRepromptService implements PasswordRepromptServiceAbstraction { - protected component = PasswordRepromptComponent; - +export class PasswordRepromptService { constructor( - private modalService: ModalService, + private dialogService: DialogService, private userVerificationService: UserVerificationService ) {} @@ -28,13 +26,12 @@ export class PasswordRepromptService implements PasswordRepromptServiceAbstracti return true; } - const ref = this.modalService.open(this.component, { allowMultipleModals: true }); + const dialog = this.dialogService.open(PasswordRepromptComponent, { + ariaModal: true, + }); - if (ref == null) { - return false; - } + const result = await lastValueFrom(dialog.closed); - const result = await ref.onClosedPromise(); return result === true; } From 7190bad1b0e81c6178b468dcdd8b6e7533ffe7ee Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Thu, 5 Oct 2023 15:14:10 -0400 Subject: [PATCH 2/2] Standardize Snapcraft commands in workflows (#6351) --- .github/workflows/release-cli.yml | 4 +--- .github/workflows/release-desktop.yml | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 73c0f24affd..04a8a04f4f5 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -157,8 +157,6 @@ jobs: - name: Install Snap uses: samuelmeuli/action-snapcraft@d33c176a9b784876d966f80fb1b461808edc0641 # v2.1.1 - with: - snapcraft_token: ${{ steps.retrieve-secrets.outputs.snapcraft-store-token }} - name: Download artifacts if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -185,7 +183,7 @@ jobs: env: SNAPCRAFT_STORE_CREDENTIALS: ${{ steps.retrieve-secrets.outputs.snapcraft-store-token }} run: | - snapcraft push bw_${{ env._PKG_VERSION }}_amd64.snap --release stable + snapcraft upload bw_${{ env._PKG_VERSION }}_amd64.snap --release stable snapcraft logout choco: diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index 28314e8e9c1..b9ffa80e512 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -270,8 +270,6 @@ jobs: - name: Install Snap uses: samuelmeuli/action-snapcraft@d33c176a9b784876d966f80fb1b461808edc0641 # v2.1.1 - env: - SNAPCRAFT_STORE_CREDENTIALS: ${{ steps.retrieve-secrets.outputs.snapcraft-store-token }} - name: Setup run: mkdir dist @@ -302,8 +300,8 @@ jobs: env: SNAPCRAFT_STORE_CREDENTIALS: ${{ steps.retrieve-secrets.outputs.snapcraft-store-token }} run: | - /snap/bin/snapcraft upload bitwarden_${{ env._PKG_VERSION }}_amd64.snap --release stable - /snap/bin/snapcraft logout + snapcraft upload bitwarden_${{ env._PKG_VERSION }}_amd64.snap --release stable + snapcraft logout working-directory: apps/desktop/dist choco: