mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
feat(auth): [PM-8221] implement device verification for unknown devices
Add device verification flow that requires users to enter an OTP when logging in from an unrecognized device. This includes: - New device verification route and guard - Email OTP verification component - Authentication timeout handling PM-8221
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
import { Injectable, NgModule } from "@angular/core";
|
||||
import { ActivatedRouteSnapshot, RouteReuseStrategy, RouterModule, Routes } from "@angular/router";
|
||||
|
||||
import { AuthenticationTimeoutComponent } from "@bitwarden/angular/auth/components/authentication-timeout.component";
|
||||
import {
|
||||
EnvironmentSelectorComponent,
|
||||
EnvironmentSelectorRouteData,
|
||||
ExtensionDefaultOverlayPosition,
|
||||
} from "@bitwarden/angular/auth/components/environment-selector.component";
|
||||
import { TwoFactorTimeoutComponent } from "@bitwarden/angular/auth/components/two-factor-auth/two-factor-auth-expired.component";
|
||||
import { unauthUiRefreshRedirect } from "@bitwarden/angular/auth/functions/unauth-ui-refresh-redirect";
|
||||
import { unauthUiRefreshSwap } from "@bitwarden/angular/auth/functions/unauth-ui-refresh-route-swap";
|
||||
import {
|
||||
authGuard,
|
||||
lockGuard,
|
||||
activeAuthGuard,
|
||||
redirectGuard,
|
||||
tdeDecryptionRequiredGuard,
|
||||
unauthGuardFn,
|
||||
} from "@bitwarden/angular/auth/guards";
|
||||
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
|
||||
import { twofactorRefactorSwap } from "@bitwarden/angular/utils/two-factor-component-refactor-route-swap";
|
||||
import { NewDeviceVerificationNoticeGuard } from "@bitwarden/angular/vault/guards";
|
||||
import {
|
||||
@@ -39,7 +41,10 @@ import {
|
||||
DevicesIcon,
|
||||
SsoComponent,
|
||||
TwoFactorTimeoutIcon,
|
||||
NewDeviceVerificationComponent,
|
||||
DeviceVerificationIcon,
|
||||
} from "@bitwarden/auth/angular";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { LockComponent } from "@bitwarden/key-management/angular";
|
||||
import {
|
||||
NewDeviceVerificationNoticePageOneComponent,
|
||||
@@ -172,12 +177,12 @@ const routes: Routes = [
|
||||
component: ExtensionAnonLayoutWrapperComponent,
|
||||
children: [
|
||||
{
|
||||
path: "2fa-timeout",
|
||||
path: "authentication-timeout",
|
||||
canActivate: [unauthGuardFn(unauthRouteOverrides)],
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
component: TwoFactorTimeoutComponent,
|
||||
component: AuthenticationTimeoutComponent,
|
||||
},
|
||||
],
|
||||
data: {
|
||||
@@ -230,6 +235,27 @@ const routes: Routes = [
|
||||
],
|
||||
},
|
||||
),
|
||||
{
|
||||
path: "device-verification",
|
||||
component: ExtensionAnonLayoutWrapperComponent,
|
||||
canActivate: [
|
||||
canAccessFeature(FeatureFlag.NewDeviceVerification),
|
||||
unauthGuardFn(),
|
||||
activeAuthGuard(),
|
||||
],
|
||||
children: [{ path: "", component: NewDeviceVerificationComponent }],
|
||||
data: {
|
||||
pageIcon: DeviceVerificationIcon,
|
||||
pageTitle: {
|
||||
key: "verifyIdentity",
|
||||
},
|
||||
pageSubtitle: {
|
||||
key: "weDontRecognizeThisDevice",
|
||||
},
|
||||
showBackButton: true,
|
||||
elevation: 1,
|
||||
} satisfies RouteDataProperties & ExtensionAnonLayoutWrapperData,
|
||||
},
|
||||
{
|
||||
path: "set-password",
|
||||
component: SetPasswordComponent,
|
||||
|
||||
Reference in New Issue
Block a user