From ae688d9e9eb78d1d0171a75812ff100aa0bcde9e Mon Sep 17 00:00:00 2001 From: vinith-kovan <156108204+vinith-kovan@users.noreply.github.com> Date: Wed, 12 Jun 2024 18:59:44 +0530 Subject: [PATCH] [PM-4961]anon-layout login component migrated (#9167) * anaon-layout login component migrated * Login component migration * Login component migration --------- Co-authored-by: Ike Kottlowski --- .../src/app/auth/login/login.component.html | 239 ++++++++---------- .../web/src/app/auth/login/login.component.ts | 7 +- apps/web/src/app/oss-routing.module.ts | 19 +- 3 files changed, 127 insertions(+), 138 deletions(-) diff --git a/apps/web/src/app/auth/login/login.component.html b/apps/web/src/app/auth/login/login.component.html index 0e29a342786..eb2a9a88aa1 100644 --- a/apps/web/src/app/auth/login/login.component.html +++ b/apps/web/src/app/auth/login/login.component.html @@ -1,155 +1,122 @@
-
-
- -

- {{ "loginOrCreateNewAccount" | i18n }} -

-
+
+ + {{ "emailAddress" | i18n }} + + +
+ +
+ + + {{ "rememberEmail" | i18n }} + +
+ +
+ +
-
- - - {{ "rememberEmail" | i18n }} - -
+
+

{{ "or" | i18n }}

-
- -
+ + {{ "loginWithPasskey" | i18n }} + +
-
-

{{ "or" | i18n }}

+
- - {{ "loginWithPasskey" | i18n }} - -
+

+ {{ "newAroundHere" | i18n }} + + {{ "createAccount" | i18n }} +

+ -
+
+
+ + {{ "masterPass" | i18n }} + + + + {{ "getMasterPasswordHint" | i18n }} +
-

- {{ "newAroundHere" | i18n }} - - {{ "createAccount" | i18n }} -

- +
+ +
-
-
- - {{ "masterPass" | i18n }} - - - - {{ "getMasterPasswordHint" | i18n }} -
+
+ +
-
- -
+
+ +
-
- -
+ -
- -
+
- - -
- -
-

{{ "loggingInAs" | i18n }} {{ loggedEmail }}

- {{ "notYou" | i18n }} -
-
-
+
+

{{ "loggingInAs" | i18n }} {{ loggedEmail }}

+ {{ "notYou" | i18n }}
diff --git a/apps/web/src/app/auth/login/login.component.ts b/apps/web/src/app/auth/login/login.component.ts index 51d46f46a42..1f174b7397a 100644 --- a/apps/web/src/app/auth/login/login.component.ts +++ b/apps/web/src/app/auth/login/login.component.ts @@ -43,7 +43,6 @@ export class LoginComponent extends BaseLoginComponent implements OnInit { enforcedPasswordPolicyOptions: MasterPasswordPolicyOptions; policies: Policy[]; showPasswordless = false; - constructor( private acceptOrganizationInviteService: AcceptOrganizationInviteService, devicesApiService: DevicesApiServiceAbstraction, @@ -92,7 +91,13 @@ export class LoginComponent extends BaseLoginComponent implements OnInit { this.onSuccessfulLoginNavigate = this.goAfterLogIn; this.showPasswordless = flagEnabled("showPasswordless"); } + submitForm = async (showToast = true) => { + return await this.submitFormHelper(showToast); + }; + private async submitFormHelper(showToast: boolean) { + await super.submit(showToast); + } async ngOnInit() { // eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe this.route.queryParams.pipe(first()).subscribe(async (qParams) => { diff --git a/apps/web/src/app/oss-routing.module.ts b/apps/web/src/app/oss-routing.module.ts index 0a15e058696..eed8b7d281c 100644 --- a/apps/web/src/app/oss-routing.module.ts +++ b/apps/web/src/app/oss-routing.module.ts @@ -66,7 +66,6 @@ const routes: Routes = [ children: [], // Children lets us have an empty component. canActivate: [redirectGuard()], // Redirects either to vault, login, or lock page. }, - { path: "login", component: LoginComponent, canActivate: [UnauthGuard] }, { path: "login-with-device", component: LoginViaAuthRequestComponent, @@ -182,6 +181,24 @@ const routes: Routes = [ path: "", component: AnonLayoutWrapperComponent, children: [ + { + path: "login", + canActivate: [unauthGuardFn()], + children: [ + { + path: "", + component: LoginComponent, + }, + { + path: "", + component: EnvironmentSelectorComponent, + outlet: "environment-selector", + }, + ], + data: { + pageTitle: "logIn", + }, + }, { path: "2fa", component: TwoFactorComponent,