From 450fc11b17259487d67995a05369f1e3abb05e5b Mon Sep 17 00:00:00 2001 From: Patrick Pimentel Date: Tue, 12 Aug 2025 09:02:06 -0400 Subject: [PATCH] feat(browser-approval): [PM-23620] Auth Request Answering Service - Getting the messaging correct. --- apps/browser/src/_locales/en/messages.json | 14 +++++++++++++- apps/browser/src/autofill/content/autofill-init.ts | 2 +- apps/browser/src/background/main.background.ts | 6 ++---- .../browser-system-notification.service.ts | 7 +------ apps/browser/src/popup/services/services.module.ts | 4 ++-- apps/web/src/locales/en/messages.json | 12 ++++++++++++ libs/angular/src/services/jslib-services.module.ts | 1 + .../auth-request-answering.service.ts | 4 +++- 8 files changed, 35 insertions(+), 15 deletions(-) diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index f8dde376b35..a58bcba21a0 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -4380,7 +4380,7 @@ }, "uriMatchDefaultStrategyHint": { "message": "URI match detection is how Bitwarden identifies autofill suggestions.", - "description": "Explains to the user that URI match detection determines how Bitwarden suggests autofill options, and clarifies that this default strategy applies when no specific match detection is set for a login item." + "description": "Explains to the user that URI match detection determines how Bitwarden suggests autofill options, and clarifies that this default strategy applies when no specific match detection is set for a login item." }, "regExAdvancedOptionWarning": { "message": "\"Regular expression\" is an advanced option with increased risk of exposing credentials.", @@ -5117,6 +5117,18 @@ "showNumberOfAutofillSuggestions": { "message": "Show number of login autofill suggestions on extension icon" }, + "accountAccessRequested": { + "message": "Account access requested" + }, + "confirmAccessAttempt": { + "message": "Confirm access attempt for $EMAIL$", + "placeholders": { + "email": { + "content": "$1", + "example": "name@example.com" + } + } + }, "showQuickCopyActions": { "message": "Show quick copy actions on Vault" }, diff --git a/apps/browser/src/autofill/content/autofill-init.ts b/apps/browser/src/autofill/content/autofill-init.ts index 5a71e3bd8da..b6fc6c3392e 100644 --- a/apps/browser/src/autofill/content/autofill-init.ts +++ b/apps/browser/src/autofill/content/autofill-init.ts @@ -35,7 +35,7 @@ class AutofillInit implements AutofillInitInterface { * @param domElementVisibilityService - Used to check if an element is viewable. * @param autofillOverlayContentService - The autofill overlay content service, potentially undefined. * @param autofillInlineMenuContentService - The inline menu content service, potentially undefined. - * @param overlayNotificationsContentService - The overlay server notifications content service, potentially undefined. + * @param overlayNotificationsContentService - The overlay notifications content service, potentially undefined. */ constructor( domQueryService: DomQueryService, diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index f413f0788e5..7355051ddbc 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -1131,10 +1131,7 @@ export default class MainBackground { this.actionsService = new BrowserActionsService(this.logService, this.platformUtilsService); if ("notifications" in chrome) { - this.systemNotificationService = new BrowserSystemNotificationService( - this.logService, - this.platformUtilsService, - ); + this.systemNotificationService = new BrowserSystemNotificationService(); } else { this.systemNotificationService = new UnsupportedSystemNotificationsService(); } @@ -1143,6 +1140,7 @@ export default class MainBackground { this.accountService, this.actionsService, this.authService, + this.i18nService, this.masterPasswordService, this.platformUtilsService, this.systemNotificationService, diff --git a/apps/browser/src/platform/system-notifications/browser-system-notification.service.ts b/apps/browser/src/platform/system-notifications/browser-system-notification.service.ts index 6f6bb9ed262..9e4f2475511 100644 --- a/apps/browser/src/platform/system-notifications/browser-system-notification.service.ts +++ b/apps/browser/src/platform/system-notifications/browser-system-notification.service.ts @@ -1,7 +1,5 @@ import { map, merge, Observable } from "rxjs"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ButtonLocation, SystemNotificationClearInfo, @@ -15,10 +13,7 @@ import { fromChromeEvent } from "../browser/from-chrome-event"; export class BrowserSystemNotificationService implements SystemNotificationsService { notificationClicked$: Observable; - constructor( - private logService: LogService, - private platformUtilsService: PlatformUtilsService, - ) { + constructor() { this.notificationClicked$ = merge( fromChromeEvent(chrome.notifications.onButtonClicked).pipe( map(([notificationId, buttonIndex]) => ({ diff --git a/apps/browser/src/popup/services/services.module.ts b/apps/browser/src/popup/services/services.module.ts index 1bb6790c987..ba671462b28 100644 --- a/apps/browser/src/popup/services/services.module.ts +++ b/apps/browser/src/popup/services/services.module.ts @@ -596,7 +596,7 @@ const safeProviders: SafeProvider[] = [ safeProvider({ provide: SystemNotificationsService, useClass: BrowserSystemNotificationService, - deps: [LogService, PlatformUtilsService], + deps: [], }), safeProvider({ provide: Fido2UserVerificationService, @@ -630,7 +630,7 @@ const safeProviders: SafeProvider[] = [ safeProvider({ provide: SystemNotificationsService, useClass: BrowserSystemNotificationService, - deps: [LogService, PlatformUtilsService], + deps: [], }), safeProvider({ provide: LoginComponentService, diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 4eaf141abc2..1db3f1f6f13 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -5426,6 +5426,18 @@ } } }, + "accountAccessRequested": { + "message": "Account access requested" + }, + "confirmAccessAttempt": { + "message": "Confirm access attempt for $EMAIL$", + "placeholders": { + "email": { + "content": "$1", + "example": "name@example.com" + } + } + }, "organizationDataOwnership": { "message": "Enforce organization data ownership" }, diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index 54902778646..1e2f9d83ba4 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -970,6 +970,7 @@ const safeProviders: SafeProvider[] = [ AccountServiceAbstraction, ActionsService, AuthServiceAbstraction, + I18nServiceAbstraction, MasterPasswordServiceAbstraction, PlatformUtilsServiceAbstraction, SystemNotificationsService, diff --git a/libs/common/src/auth/services/auth-request-answering/auth-request-answering.service.ts b/libs/common/src/auth/services/auth-request-answering/auth-request-answering.service.ts index af0e20fcbcd..29f57acbc8c 100644 --- a/libs/common/src/auth/services/auth-request-answering/auth-request-answering.service.ts +++ b/libs/common/src/auth/services/auth-request-answering/auth-request-answering.service.ts @@ -6,6 +6,7 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authenticatio import { ForceSetPasswordReason } from "@bitwarden/common/auth/models/domain/force-set-password-reason"; import { getUserId } from "@bitwarden/common/auth/services/account.service"; import { MasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; +import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { ActionsService } from "@bitwarden/common/platform/actions"; import { @@ -22,6 +23,7 @@ export class AuthRequestAnsweringService implements AuthRequestAnsweringServiceA private readonly accountService: AccountService, private readonly actionService: ActionsService, private readonly authService: AuthService, + private readonly i18nService: I18nService, private readonly masterPasswordService: MasterPasswordServiceAbstraction, private readonly platformUtilsService: PlatformUtilsService, private readonly systemNotificationsService: SystemNotificationsService, @@ -54,7 +56,7 @@ export class AuthRequestAnsweringService implements AuthRequestAnsweringServiceA } else { await this.systemNotificationsService.create({ id: `authRequest_${authRequestId}`, - title: "Test (i18n)", + title: this.i18nService.t("accountAccessRequested"), body: "Pending Auth Request to Approve (i18n)", buttons: [], });