1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-07 12:13:45 +00:00

feat(change-password-component): Change Password Update [18720] - Adding more content for the routing.

This commit is contained in:
Patrick Pimentel
2025-05-28 10:56:16 -04:00
parent ec81662dcf
commit 5e2e0dda8e
4 changed files with 25 additions and 7 deletions

View File

@@ -556,7 +556,6 @@ const routes: Routes = [
showBackButton: true,
} satisfies RouteDataProperties & ExtensionAnonLayoutWrapperData,
},
// TODO: Should this have any guards?
{
path: "change-password",
data: {

View File

@@ -14,6 +14,7 @@ import {
tdeDecryptionRequiredGuard,
unauthGuardFn,
} from "@bitwarden/angular/auth/guards";
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
import { featureFlaggedRoute } from "@bitwarden/angular/platform/utils/feature-flagged-route";
import {
AnonLayoutWrapperComponent,
@@ -40,6 +41,7 @@ import {
TwoFactorAuthGuard,
NewDeviceVerificationComponent,
DeviceVerificationIcon,
ChangePasswordComponent,
} from "@bitwarden/auth/angular";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { LockComponent } from "@bitwarden/key-management-ui";
@@ -119,7 +121,15 @@ const routes: Routes = [
{
path: "update-temp-password",
component: UpdateTempPasswordComponent,
canActivate: [authGuard],
canActivate: [
canAccessFeature(
FeatureFlag.PM16117_ChangeExistingPasswordRefactor,
false,
`/change-password`,
false,
),
authGuard,
],
},
{
path: "remove-password",
@@ -323,6 +333,11 @@ const routes: Routes = [
},
} satisfies RouteDataProperties & AnonLayoutWrapperData,
},
{
path: "change-password",
component: ChangePasswordComponent,
// canActivate: [authGuard],
},
],
},
];

View File

@@ -601,6 +601,7 @@ const routes: Routes = [
{
path: "change-password",
component: ChangePasswordComponent,
// canActivate: [authGuard],
},
],
},

View File

@@ -65,11 +65,14 @@ export const authGuard: CanActivateFn = async (
return router.createUrlTree(["/set-password"]);
}
if (
forceSetPasswordReason !== ForceSetPasswordReason.None &&
!routerState.url.includes("update-temp-password")
) {
return router.createUrlTree(["/update-temp-password"]);
if (forceSetPasswordReason !== ForceSetPasswordReason.None) {
if (!routerState.url.includes("update-temp-password")) {
return router.createUrlTree(["/update-temp-password"]);
}
if (!routerState.url.includes("change-password")) {
return router.createUrlTree(["/change-password"]);
}
}
return true;