mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-30 12:54:31 +01:00
Implement the markAsDirty form controls for AddEditComponent(#761).
This commit is contained in:
parent
0724041daf
commit
06f2364733
@ -1,4 +1,4 @@
|
|||||||
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise">
|
<form #form="ngForm" (ngSubmit)="submit()" [appApiAction]="formPromise">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="inner-content" *ngIf="cipher">
|
<div class="inner-content" *ngIf="cipher">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
@ -3,7 +3,9 @@ import {
|
|||||||
NgZone,
|
NgZone,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { NgForm } from '@angular/forms';
|
||||||
|
|
||||||
import { AuditService } from 'jslib/abstractions/audit.service';
|
import { AuditService } from 'jslib/abstractions/audit.service';
|
||||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||||
@ -21,6 +23,7 @@ import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
|||||||
|
|
||||||
import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component';
|
import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component';
|
||||||
|
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = 'AddEditComponent';
|
const BroadcasterSubscriptionId = 'AddEditComponent';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -28,6 +31,8 @@ const BroadcasterSubscriptionId = 'AddEditComponent';
|
|||||||
templateUrl: 'add-edit.component.html',
|
templateUrl: 'add-edit.component.html',
|
||||||
})
|
})
|
||||||
export class AddEditComponent extends BaseAddEditComponent implements OnChanges, OnDestroy {
|
export class AddEditComponent extends BaseAddEditComponent implements OnChanges, OnDestroy {
|
||||||
|
@ViewChild('form')
|
||||||
|
private form: NgForm;
|
||||||
constructor(cipherService: CipherService, folderService: FolderService,
|
constructor(cipherService: CipherService, folderService: FolderService,
|
||||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
auditService: AuditService, stateService: StateService,
|
auditService: AuditService, stateService: StateService,
|
||||||
@ -84,4 +89,8 @@ export class AddEditComponent extends BaseAddEditComponent implements OnChanges,
|
|||||||
return (!this.editMode || this.cloneMode) && this.ownershipOptions
|
return (!this.editMode || this.cloneMode) && this.ownershipOptions
|
||||||
&& (this.ownershipOptions.length > 1 || !this.allowPersonal);
|
&& (this.ownershipOptions.length > 1 || !this.allowPersonal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markPasswordAsDirty() {
|
||||||
|
this.form.controls['Login.Password'].markAsDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,6 +554,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
this.modal.close();
|
this.modal.close();
|
||||||
if (this.addEditComponent != null && this.addEditComponent.cipher != null &&
|
if (this.addEditComponent != null && this.addEditComponent.cipher != null &&
|
||||||
this.addEditComponent.cipher.type === CipherType.Login && this.addEditComponent.cipher.login != null) {
|
this.addEditComponent.cipher.type === CipherType.Login && this.addEditComponent.cipher.login != null) {
|
||||||
|
this.addEditComponent.markPasswordAsDirty();
|
||||||
this.addEditComponent.cipher.login.password = password;
|
this.addEditComponent.cipher.login.password = password;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user