diff --git a/libs/angular/src/auth/password-management/set-initial-password/set-initial-password.component.ts b/libs/angular/src/auth/password-management/set-initial-password/set-initial-password.component.ts index f1c7bf48050..75eb8e8ce01 100644 --- a/libs/angular/src/auth/password-management/set-initial-password/set-initial-password.component.ts +++ b/libs/angular/src/auth/password-management/set-initial-password/set-initial-password.component.ts @@ -22,7 +22,6 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { ForceSetPasswordReason } from "@bitwarden/common/auth/models/domain/force-set-password-reason"; import { assertTruthy, assertNonNullish } from "@bitwarden/common/auth/utils"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key-management/master-password/abstractions/master-password.service.abstraction"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -199,16 +198,14 @@ export class SetInitialPasswordComponent implements OnInit { switch (this.userType) { case SetInitialPasswordUserType.JIT_PROVISIONED_MP_ORG_USER: case SetInitialPasswordUserType.TDE_ORG_USER_RESET_PASSWORD_PERMISSION_REQUIRES_MP: { - const newApisFlagEnabled = await this.configService.getFeatureFlag( - FeatureFlag.PM27086_UpdateAuthenticationApisForInputPassword, - ); - - if (newApisFlagEnabled) { + // Remove wrapping "if" check in PM-28143 + if (passwordInputResult.newApisFlagEnabled) { await this.setInitialPasswordV2(passwordInputResult); return; } await this.setInitialPassword(passwordInputResult); + break; } case SetInitialPasswordUserType.OFFBOARDED_TDE_ORG_USER: diff --git a/libs/auth/src/angular/input-password/input-password.component.ts b/libs/auth/src/angular/input-password/input-password.component.ts index 0548f7bef9d..755d0604008 100644 --- a/libs/auth/src/angular/input-password/input-password.component.ts +++ b/libs/auth/src/angular/input-password/input-password.component.ts @@ -377,6 +377,7 @@ export class InputPasswordComponent implements OnInit { salt, newPasswordHint, rotateUserKey: this.formGroup.controls.rotateUserKey?.value ?? false, + newApisFlagEnabled, // To be removed in PM-28143 }; // 5. Emit and return PasswordInputResult object @@ -411,6 +412,7 @@ export class InputPasswordComponent implements OnInit { newLocalMasterKeyHash, newPasswordHint, kdfConfig: this.kdfConfig, + newApisFlagEnabled, }; if ( diff --git a/libs/auth/src/angular/input-password/password-input-result.ts b/libs/auth/src/angular/input-password/password-input-result.ts index 923ba86594a..a13c754b93c 100644 --- a/libs/auth/src/angular/input-password/password-input-result.ts +++ b/libs/auth/src/angular/input-password/password-input-result.ts @@ -10,6 +10,14 @@ export interface PasswordInputResult { newPasswordHint?: string; rotateUserKey?: boolean; + /** + * Temporary property that persists the flag state through the entire set/change password process. + * Consumers will use this value instead of re-checking the flag state via ConfigService themselves. + * + * To be removed in PM-28143 + */ + newApisFlagEnabled: boolean; + // The deprecated properties below will be removed in PM-28143: https://bitwarden.atlassian.net/browse/PM-28143 /** @deprecated This low-level cryptographic state will be removed. It will be replaced by high level calls to masterpassword service, in the consumers of this interface. */