mirror of
https://github.com/bitwarden/browser
synced 2025-12-27 05:33:59 +00:00
Enables one of the recommended rules of @angular-eslint. Since this rule was fairly trivial to fix and has no QA effects it seemed reasonable to migrate all code.
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import { Component, OnInit, inject } from "@angular/core";
|
|
import { FormBuilder, Validators } from "@angular/forms";
|
|
|
|
import { LockComponent as BaseLockComponent } from "@bitwarden/angular/auth/components/lock.component";
|
|
|
|
import { SharedModule } from "../shared";
|
|
|
|
@Component({
|
|
selector: "app-lock",
|
|
templateUrl: "lock.component.html",
|
|
standalone: true,
|
|
imports: [SharedModule],
|
|
})
|
|
export class LockComponent extends BaseLockComponent implements OnInit {
|
|
formBuilder = inject(FormBuilder);
|
|
|
|
formGroup = this.formBuilder.group({
|
|
masterPassword: ["", { validators: Validators.required, updateOn: "submit" }],
|
|
});
|
|
|
|
get masterPasswordFormControl() {
|
|
return this.formGroup.controls.masterPassword;
|
|
}
|
|
|
|
async ngOnInit() {
|
|
await super.ngOnInit();
|
|
|
|
this.masterPasswordFormControl.setValue(this.masterPassword);
|
|
|
|
this.onSuccessfulSubmit = async () => {
|
|
await this.router.navigateByUrl(this.successRoute);
|
|
};
|
|
}
|
|
|
|
async superSubmit() {
|
|
await super.submit();
|
|
}
|
|
|
|
submit = async () => {
|
|
this.formGroup.markAllAsTouched();
|
|
|
|
if (this.formGroup.invalid) {
|
|
return;
|
|
}
|
|
|
|
this.masterPassword = this.masterPasswordFormControl.value;
|
|
await this.superSubmit();
|
|
};
|
|
}
|