mirror of
https://github.com/bitwarden/browser
synced 2025-12-27 05:33:59 +00:00
* PM-4950 Migrate Hint Component * PM-4950 Updated Anon layout changes * PM-4950 Addressed review comments * PM-4950 - Tweak form control + add comment. * PM-4950 - Address PR feedback * PM-4950 - Move canActivate up a level. * PM-4950 - Consolidate route under AnonLayoutWrapperComponent path from merging in main. --------- Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com> Co-authored-by: Jared Snider <jsnider@bitwarden.com> Co-authored-by: Todd Martin <tmartin@bitwarden.com>
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
import { Component } from "@angular/core";
|
|
import { FormBuilder, Validators } from "@angular/forms";
|
|
import { Router } from "@angular/router";
|
|
|
|
import { HintComponent as BaseHintComponent } from "@bitwarden/angular/auth/components/hint.component";
|
|
import { LoginEmailServiceAbstraction } from "@bitwarden/auth/common";
|
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
|
|
|
@Component({
|
|
selector: "app-hint",
|
|
templateUrl: "hint.component.html",
|
|
})
|
|
export class HintComponent extends BaseHintComponent {
|
|
formGroup = this.formBuilder.group({
|
|
email: ["", [Validators.email, Validators.required]],
|
|
});
|
|
|
|
get emailFormControl() {
|
|
return this.formGroup.controls.email;
|
|
}
|
|
|
|
constructor(
|
|
router: Router,
|
|
i18nService: I18nService,
|
|
apiService: ApiService,
|
|
platformUtilsService: PlatformUtilsService,
|
|
logService: LogService,
|
|
loginEmailService: LoginEmailServiceAbstraction,
|
|
private formBuilder: FormBuilder,
|
|
) {
|
|
super(router, i18nService, apiService, platformUtilsService, logService, loginEmailService);
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
super.ngOnInit();
|
|
this.emailFormControl.setValue(this.email);
|
|
}
|
|
|
|
// Wrapper method to call super.submit() since properties (e.g., submit) cannot use super directly
|
|
// This is because properties are assigned per type and generally don't have access to the prototype
|
|
async superSubmit() {
|
|
await super.submit();
|
|
}
|
|
|
|
submit = async () => {
|
|
this.email = this.emailFormControl.value;
|
|
await this.superSubmit();
|
|
};
|
|
}
|