mirror of
https://github.com/bitwarden/browser
synced 2026-01-30 08:13:44 +00:00
[PM-27086] refactor flag logic to only check flag value in one location
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user