mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
[PM-24304][PM-24305] - [Defect] Some fields are not disabled when editing an item from My Vault (#15982)
* disable all remaining form fields for editing personally owned My Items * fix failing tests * ensure collection field is also properly disabled * clean up logic * fix failing test * fix test * refactor variable to avoid using `is` prefix * directly reference parent form for status rather than subscribe to it * refactor subscription for form status changes * use observable as an Output * disable attachment button on desktop vault when the form * disable custom field components when custom fields already exist and parent form is disabled * disable attachments button in the browser when the edit form is disabled * grab icon button instance for disabled state --------- Co-authored-by: Nick Krantz <nick@livefront.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { DatePipe, NgIf } from "@angular/common";
|
||||
import { Component, inject, OnInit, Optional } from "@angular/core";
|
||||
import { Component, DestroyRef, inject, OnInit, Optional } from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { FormBuilder, ReactiveFormsModule } from "@angular/forms";
|
||||
import { map } from "rxjs";
|
||||
@@ -81,6 +81,8 @@ export class LoginDetailsSectionComponent implements OnInit {
|
||||
*/
|
||||
private existingFido2Credentials?: Fido2CredentialView[];
|
||||
|
||||
private destroyRef = inject(DestroyRef);
|
||||
|
||||
get hasPasskey(): boolean {
|
||||
return this.existingFido2Credentials != null && this.existingFido2Credentials.length > 0;
|
||||
}
|
||||
@@ -148,6 +150,19 @@ export class LoginDetailsSectionComponent implements OnInit {
|
||||
if (this.cipherFormContainer.config.mode === "partial-edit") {
|
||||
this.loginDetailsForm.disable();
|
||||
}
|
||||
|
||||
// If the form is enabled, ensure to disable password or TOTP
|
||||
// for hidden password users
|
||||
this.cipherFormContainer.formStatusChange$
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((status) => {
|
||||
if (status === "enabled") {
|
||||
if (!this.viewHiddenFields) {
|
||||
this.loginDetailsForm.controls.password.disable();
|
||||
this.loginDetailsForm.controls.totp.disable();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private initFromExistingCipher(existingLogin: LoginView) {
|
||||
|
||||
Reference in New Issue
Block a user