handle oss-routing swap

This commit is contained in:
rr-bw 2024-09-12 09:19:21 -07:00
parent f9dc91228b
commit c89eb92a63
No known key found for this signature in database
GPG Key ID: 3FA13C3ADEE51D5D
4 changed files with 70 additions and 44 deletions

View File

@ -40,7 +40,7 @@
routerLink="/login-with-passkey" routerLink="/login-with-passkey"
(mousedown)="$event.preventDefault()" (mousedown)="$event.preventDefault()"
> >
<span><i class="bwi bwi-passkey"></i> {{ "loginWithPasskey" | i18n }}</span> <span><i class="bwi bwi-passkey"></i> {{ "logInWithPasskey" | i18n }}</span>
</a> </a>
</div> </div>

View File

@ -1,6 +1,7 @@
import { NgModule } from "@angular/core"; import { NgModule } from "@angular/core";
import { Route, RouterModule, Routes } from "@angular/router"; import { Route, RouterModule, Routes } from "@angular/router";
import { unauthUiRefreshSwap } from "@bitwarden/angular/auth/functions/unauth-ui-refresh-route-swap";
import { import {
authGuard, authGuard,
lockGuard, lockGuard,
@ -20,6 +21,7 @@ import {
LockIcon, LockIcon,
RegistrationLinkExpiredComponent, RegistrationLinkExpiredComponent,
LoginComponentV2, LoginComponentV2,
LoginSecondaryContentComponent,
} from "@bitwarden/auth/angular"; } from "@bitwarden/auth/angular";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
@ -168,6 +170,51 @@ const routes: Routes = [
}, },
], ],
}, },
...unauthUiRefreshSwap(
AnonLayoutWrapperComponent,
AnonLayoutWrapperComponent,
{
path: "login",
canActivate: [unauthGuardFn()],
children: [
{
path: "",
component: LoginComponent,
},
{
path: "",
component: EnvironmentSelectorComponent,
outlet: "environment-selector",
},
],
data: {
pageTitle: "logIn",
},
},
{
path: "login",
canActivate: [unauthGuardFn()],
data: {
pageTitle: "logInToBitwarden",
} satisfies DataProperties & AnonLayoutWrapperData,
children: [
{
path: "",
component: LoginComponentV2,
},
{
path: "",
component: LoginSecondaryContentComponent,
outlet: "secondary",
},
{
path: "",
component: EnvironmentSelectorComponent,
outlet: "environment-selector",
},
],
},
),
{ {
path: "", path: "",
component: AnonLayoutWrapperComponent, component: AnonLayoutWrapperComponent,
@ -269,24 +316,6 @@ const routes: Routes = [
}, },
], ],
}, },
{
path: "login",
canActivate: [unauthGuardFn()],
data: {
pageTitle: "logInToBitwarden",
} satisfies DataProperties & AnonLayoutWrapperData,
children: [
{
path: "",
component: LoginComponentV2,
},
{
path: "",
component: EnvironmentSelectorComponent,
outlet: "environment-selector",
},
],
},
{ {
path: "lock", path: "lock",
canActivate: [deepLinkGuard(), lockGuard()], canActivate: [deepLinkGuard(), lockGuard()],

View File

@ -881,6 +881,9 @@
"createAccount": { "createAccount": {
"message": "Create account" "message": "Create account"
}, },
"newToBitwarden": {
"message": "New to Bitwarden?"
},
"setAStrongPassword": { "setAStrongPassword": {
"message": "Set a strong password" "message": "Set a strong password"
}, },

View File

@ -44,31 +44,26 @@
> >
<ng-container *ngIf="uiState === LoginUiState.EMAIL_ENTRY"> <ng-container *ngIf="uiState === LoginUiState.EMAIL_ENTRY">
<!-- Email Address input --> <!-- Email Address input -->
<div class="tw-mb-3"> <bit-form-field class="!tw-mb-4">
<bit-form-field>
<bit-label>{{ "emailAddress" | i18n }}</bit-label> <bit-label>{{ "emailAddress" | i18n }}</bit-label>
<input type="email" formControlName="email" bitInput appAutofocus /> <input type="email" formControlName="email" bitInput appAutofocus />
</bit-form-field> </bit-form-field>
</div>
<!-- Remember Email input --> <!-- Remember Email input -->
<div class="tw-mb-3 tw-flex tw-items-start"> <bit-form-control class="!tw-mb-4">
<bit-form-control class="tw-mb-0">
<input type="checkbox" formControlName="rememberEmail" bitCheckbox /> <input type="checkbox" formControlName="rememberEmail" bitCheckbox />
<bit-label>{{ "rememberEmail" | i18n }}</bit-label> <bit-label>{{ "rememberEmail" | i18n }}</bit-label>
</bit-form-control> </bit-form-control>
</div>
<div class="tw-grid tw-gap-3 tw-text-center">
<!-- Continue button --> <!-- Continue button -->
<div class="tw-mb-3">
<button type="submit" bitButton block buttonType="primary" (click)="validateEmail()"> <button type="submit" bitButton block buttonType="primary" (click)="validateEmail()">
<span> {{ "continue" | i18n }} </span> <span> {{ "continue" | i18n }} </span>
</button> </button>
</div>
<div>{{ "or" | i18n }}</div>
<!-- Link to Login with Passkey page --> <!-- Link to Login with Passkey page -->
<div class="tw-mb-3 tw-flex tw-flex-col tw-items-center tw-justify-center">
<p class="tw-mb-3">{{ "or" | i18n }}</p>
<a <a
bitLink bitLink
block block
@ -80,11 +75,10 @@
</a> </a>
</div> </div>
<hr /> <!-- TODO-rr-bw: according to Figma, move this to AnonLayout secondary content -->
<!-- Link to Create Account page --> <!-- Link to Create Account page -->
<p class="tw-m-0 tw-text-sm"> <!-- <p class="tw-m-0 tw-text-sm">
{{ "newAroundHere" | i18n }} {{ "newAroundHere" | i18n }} -->
<!-- Two notes: <!-- Two notes:
(1) We check the value and validity of email so we don't send an invalid email to autofill (1) We check the value and validity of email so we don't send an invalid email to autofill
on load of register for both enter and mouse based navigation on load of register for both enter and mouse based navigation
@ -92,13 +86,13 @@
and move the create account link down the page on click which causes the user to miss actually and move the create account link down the page on click which causes the user to miss actually
clicking on the link. Mousedown fires before onBlur. clicking on the link. Mousedown fires before onBlur.
--> -->
<a <!-- <a
[routerLink]="registerRoute$ | async" [routerLink]="registerRoute$ | async"
[queryParams]="emailFormControl.valid ? { email: emailFormControl.value } : {}" [queryParams]="emailFormControl.valid ? { email: emailFormControl.value } : {}"
(mousedown)="goToRegister()" (mousedown)="goToRegister()"
>{{ "createAccount" | i18n }}</a >{{ "createAccount" | i18n }}</a
> >
</p> </p> -->
</ng-container> </ng-container>
<!-- <!--