From c739a884b4234552477a8afe2505ddd440eb2b0b Mon Sep 17 00:00:00 2001 From: Ike <137194738+ike-kottlowski@users.noreply.github.com> Date: Fri, 7 Mar 2025 18:03:13 -0500 Subject: [PATCH] [PM-15015] Adding Request Country Name to auth requests approval dialog (#13718) * feat(pm-15015) : - Adding `requestCountryName` to auth requests dialogs, and response models. - Updated i18n messages.json in Web, Browser, and Desktop to include "Location" translation. --- apps/browser/src/_locales/en/messages.json | 3 +++ apps/desktop/src/locales/en/messages.json | 5 ++++- apps/web/src/locales/en/messages.json | 3 +++ .../auth-requests/pending-auth-request.view.ts | 1 + .../pending-organization-auth-request.response.ts | 2 ++ .../angular/login-approval/login-approval.component.html | 7 +++++-- .../login-via-auth-request.component.ts | 2 +- .../src/auth/models/response/auth-request.response.ts | 2 ++ 8 files changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index bdeffad2bbf..1679fcfcf3f 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -901,6 +901,9 @@ "no": { "message": "No" }, + "location": { + "message": "Location" + }, "unexpectedError": { "message": "An unexpected error has occurred." }, diff --git a/apps/desktop/src/locales/en/messages.json b/apps/desktop/src/locales/en/messages.json index 1b49b7ce3a0..b485b471ccb 100644 --- a/apps/desktop/src/locales/en/messages.json +++ b/apps/desktop/src/locales/en/messages.json @@ -878,7 +878,7 @@ }, "useYourRecoveryCode": { "message": "Use your recovery code" - }, + }, "insertYubiKey": { "message": "Insert your YubiKey into your computer's USB port, then touch its button." }, @@ -1009,6 +1009,9 @@ "no": { "message": "No" }, + "location": { + "message": "Location" + }, "overwritePassword": { "message": "Overwrite password" }, diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 499e0575727..229cca65ae5 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -1053,6 +1053,9 @@ "no": { "message": "No" }, + "location": { + "message": "Location" + }, "loginOrCreateNewAccount": { "message": "Log in or create a new account to access your secure vault." }, diff --git a/bitwarden_license/bit-common/src/admin-console/auth-requests/pending-auth-request.view.ts b/bitwarden_license/bit-common/src/admin-console/auth-requests/pending-auth-request.view.ts index d32d6fcfbc7..b0f65cd3f76 100644 --- a/bitwarden_license/bit-common/src/admin-console/auth-requests/pending-auth-request.view.ts +++ b/bitwarden_license/bit-common/src/admin-console/auth-requests/pending-auth-request.view.ts @@ -13,6 +13,7 @@ export class PendingAuthRequestView implements View { requestDeviceIdentifier: string; requestDeviceType: string; requestIpAddress: string; + requestCountryName: string; creationDate: Date; static fromResponse(response: PendingOrganizationAuthRequestResponse): PendingAuthRequestView { diff --git a/bitwarden_license/bit-common/src/admin-console/auth-requests/pending-organization-auth-request.response.ts b/bitwarden_license/bit-common/src/admin-console/auth-requests/pending-organization-auth-request.response.ts index b4854eea4aa..0f686d17edd 100644 --- a/bitwarden_license/bit-common/src/admin-console/auth-requests/pending-organization-auth-request.response.ts +++ b/bitwarden_license/bit-common/src/admin-console/auth-requests/pending-organization-auth-request.response.ts @@ -9,6 +9,7 @@ export class PendingOrganizationAuthRequestResponse extends BaseResponse { requestDeviceIdentifier: string; requestDeviceType: string; requestIpAddress: string; + requestCountryName: string; creationDate: string; constructor(response: any) { @@ -21,6 +22,7 @@ export class PendingOrganizationAuthRequestResponse extends BaseResponse { this.requestDeviceIdentifier = this.getResponseProperty("RequestDeviceIdentifier"); this.requestDeviceType = this.getResponseProperty("RequestDeviceType"); this.requestIpAddress = this.getResponseProperty("RequestIpAddress"); + this.requestCountryName = this.getResponseProperty("RequestCountryName"); this.creationDate = this.getResponseProperty("CreationDate"); } } diff --git a/libs/auth/src/angular/login-approval/login-approval.component.html b/libs/auth/src/angular/login-approval/login-approval.component.html index 2115bdbff11..d37e30c5e0a 100644 --- a/libs/auth/src/angular/login-approval/login-approval.component.html +++ b/libs/auth/src/angular/login-approval/login-approval.component.html @@ -18,8 +18,11 @@

{{ authRequestResponse?.requestDeviceType }}

- {{ "ipAddress" | i18n }} -

{{ authRequestResponse?.requestIpAddress }}

+ {{ "location" | i18n }} +

+ {{ authRequestResponse?.requestCountryName }} + ({{ authRequestResponse?.requestIpAddress }}) +

{{ "time" | i18n }} diff --git a/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts b/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts index 00e2d621c47..dab516e0916 100644 --- a/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts +++ b/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts @@ -382,7 +382,7 @@ export class LoginViaAuthRequestComponent implements OnInit, OnDestroy { * | Standard Flow 1 | unauthed | "Login with device" [/login] | /login-with-device | yes | * | Standard Flow 2 | unauthed | "Login with device" [/login] | /login-with-device | no | * | Standard Flow 3 | authed | "Approve from your other device" [/login-initiated] | /login-with-device | yes | - * | Standard Flow 4 | authed | "Approve from your other device" [/login-initiated] | /login-with-device | no | | + * | Standard Flow 4 | authed | "Approve from your other device" [/login-initiated] | /login-with-device | no | * | Admin Flow | authed | "Request admin approval" [/login-initiated] | /admin-approval-requested | NA - admin requests always send encrypted userKey | * |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| * * Note 1: The phrase "in memory" here is important. It is possible for a user to have a master password for their account, but not have a masterKey IN MEMORY for diff --git a/libs/common/src/auth/models/response/auth-request.response.ts b/libs/common/src/auth/models/response/auth-request.response.ts index 88e7c542fae..372ae047f4d 100644 --- a/libs/common/src/auth/models/response/auth-request.response.ts +++ b/libs/common/src/auth/models/response/auth-request.response.ts @@ -10,6 +10,7 @@ export class AuthRequestResponse extends BaseResponse { requestDeviceTypeValue: DeviceType; requestDeviceIdentifier: string; requestIpAddress: string; + requestCountryName: string; key: string; // could be either an encrypted MasterKey or an encrypted UserKey masterPasswordHash: string; // if hash is present, the `key` above is an encrypted MasterKey (else `key` is an encrypted UserKey) creationDate: string; @@ -26,6 +27,7 @@ export class AuthRequestResponse extends BaseResponse { this.requestDeviceTypeValue = this.getResponseProperty("RequestDeviceTypeValue"); this.requestDeviceIdentifier = this.getResponseProperty("RequestDeviceIdentifier"); this.requestIpAddress = this.getResponseProperty("RequestIpAddress"); + this.requestCountryName = this.getResponseProperty("RequestCountryName"); this.key = this.getResponseProperty("Key"); this.masterPasswordHash = this.getResponseProperty("MasterPasswordHash"); this.creationDate = this.getResponseProperty("CreationDate");