mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 18:23:31 +00:00
handle browser routing and basic browser template
This commit is contained in:
@@ -1,4 +1,20 @@
|
||||
<form [bitSubmit]="submit.bind(null, false)" [formGroup]="formGroup">
|
||||
<!-- Web Template -->
|
||||
|
||||
<!--
|
||||
TODO-rr-bw: Clarify this comment if necessary.
|
||||
|
||||
Why not use <form *ngIf="clientType === ClientType.Web"> to display this section?
|
||||
Because this file contains 3 separate templates for Web, Browser, and Desktop. For Web,
|
||||
we want access to the masterPasswordInput reference in the class file.
|
||||
- If we used *ngIf, we would not be able to access the reference initially.
|
||||
- Using a hidden form allows us to access the reference, because it ensures that the element
|
||||
reference does exist (it's just potentially hidden instead of non-existent).
|
||||
-->
|
||||
<form
|
||||
[ngClass]="{ 'tw-hidden': clientType !== ClientType.Web }"
|
||||
[bitSubmit]="submit.bind(null, false)"
|
||||
[formGroup]="formGroup"
|
||||
>
|
||||
<!-------------------------
|
||||
UI STATE 1: Email Entry
|
||||
-------------------------->
|
||||
@@ -141,3 +157,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Browser Template -->
|
||||
<form *ngIf="clientType === ClientType.Browser" [bitSubmit]="submit" [formGroup]="formGroup">
|
||||
<main tabindex="-1"></main>
|
||||
</form>
|
||||
|
||||
@@ -62,6 +62,7 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
|
||||
captcha: CaptchaIFrame;
|
||||
captchaToken: string = null;
|
||||
clientType: ClientType;
|
||||
ClientType = ClientType;
|
||||
registerRoute$ = this.registerRouteService.registerRoute$(); // TODO: remove when email verification flag is removed
|
||||
showLoginWithDevice = false;
|
||||
validatedEmail = false;
|
||||
@@ -140,7 +141,7 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
|
||||
this.destroy$.complete();
|
||||
}
|
||||
|
||||
submit = async (showToast: boolean): Promise<void> => {
|
||||
submit = async (showToast = true): Promise<void> => {
|
||||
const data = this.formGroup.value;
|
||||
|
||||
await this.setupCaptcha();
|
||||
@@ -153,6 +154,8 @@ export class LoginComponentV2 implements OnInit, OnDestroy {
|
||||
}
|
||||
// Web specific (end)
|
||||
|
||||
// TODO-rr-bw: handle toast here for Browser/Desktop? See base LoginComponent -> submit()
|
||||
|
||||
const credentials = new PasswordLoginCredentials(
|
||||
data.email,
|
||||
data.masterPassword,
|
||||
|
||||
Reference in New Issue
Block a user