1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-27 17:18:04 +01:00

Manually route to signup page when the email verification feature flag is enabled

This commit is contained in:
Alec Rippberger 2024-11-14 13:05:32 -06:00
parent a4156799e9
commit f3a2b412b9
No known key found for this signature in database
GPG Key ID: 9DD8DA583B28154A

View File

@ -1,5 +1,5 @@
import { NgModule } from "@angular/core";
import { Route, RouterModule, Routes } from "@angular/router";
import { inject, NgModule } from "@angular/core";
import { Route, Router, RouterModule, Routes } from "@angular/router";
import { unauthUiRefreshSwap } from "@bitwarden/angular/auth/functions/unauth-ui-refresh-route-swap";
import {
@ -33,6 +33,7 @@ import {
VaultIcon,
} from "@bitwarden/auth/angular";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { twofactorRefactorSwap } from "../../../../libs/angular/src/utils/two-factor-component-refactor-route-swap";
import { flagEnabled, Flags } from "../utils/flags";
@ -120,7 +121,17 @@ const routes: Routes = [
path: "register",
component: TrialInitiationComponent,
canActivate: [
canAccessFeature(FeatureFlag.EmailVerification, false, "/signup"),
async () => {
const configService = inject(ConfigService);
const router = inject(Router);
return configService.getFeatureFlag(FeatureFlag.EmailVerification).then((flagValue) => {
if (flagValue === true) {
return router.createUrlTree(["/signup"]);
}
return true;
});
},
unauthGuardFn(),
],
data: { titleId: "createAccount" } satisfies RouteDataProperties,