1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-17 09:59:41 +00:00

[PM-27086] refactor addition of optional currentPassword and rotateUserKey properties to only happen in certain flows

This commit is contained in:
rr-bw
2025-12-30 14:10:13 -08:00
parent 6c0a11c940
commit 55b0f0c773

View File

@@ -371,15 +371,24 @@ export class InputPasswordComponent implements OnInit {
if (newApisFlagEnabled) {
// 4. Build a PasswordInputResult object
const passwordInputResult: PasswordInputResult = {
currentPassword,
newPassword,
kdfConfig: this.kdfConfig,
salt,
newPasswordHint,
rotateUserKey: this.formGroup.controls.rotateUserKey?.value ?? false,
newApisFlagEnabled, // To be removed in PM-28143
};
if (
this.flow === InputPasswordFlow.ChangePassword ||
this.flow === InputPasswordFlow.ChangePasswordWithOptionalUserKeyRotation
) {
passwordInputResult.currentPassword = currentPassword;
}
if (this.flow === InputPasswordFlow.ChangePasswordWithOptionalUserKeyRotation) {
passwordInputResult.rotateUserKey = this.formGroup.controls.rotateUserKey?.value;
}
// 5. Emit and return PasswordInputResult object
this.onPasswordFormSubmit.emit(passwordInputResult);
return passwordInputResult;