mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
/register does not redirect to /signup when email-verification flag is enabled (#12001)
* Manually route to signup page when the email verification feature flag is enabled
* Revert "Manually route to signup page when the email verification feature flag is enabled"
This reverts commit f3a2b412b9.
* Do not show toast when redirecting to signup
This commit is contained in:
@@ -112,7 +112,7 @@ const routes: Routes = [
|
|||||||
path: "register",
|
path: "register",
|
||||||
component: TrialInitiationComponent,
|
component: TrialInitiationComponent,
|
||||||
canActivate: [
|
canActivate: [
|
||||||
canAccessFeature(FeatureFlag.EmailVerification, false, "/signup"),
|
canAccessFeature(FeatureFlag.EmailVerification, false, "/signup", false),
|
||||||
unauthGuardFn(),
|
unauthGuardFn(),
|
||||||
],
|
],
|
||||||
data: { titleId: "createAccount" } satisfies RouteDataProperties,
|
data: { titleId: "createAccount" } satisfies RouteDataProperties,
|
||||||
|
|||||||
@@ -16,11 +16,13 @@ type FlagValue = boolean | number | string;
|
|||||||
* @param featureFlag - The feature flag to check
|
* @param featureFlag - The feature flag to check
|
||||||
* @param requiredFlagValue - Optional value to the feature flag must be equal to, defaults to true
|
* @param requiredFlagValue - Optional value to the feature flag must be equal to, defaults to true
|
||||||
* @param redirectUrlOnDisabled - Optional url to redirect to if the feature flag is disabled
|
* @param redirectUrlOnDisabled - Optional url to redirect to if the feature flag is disabled
|
||||||
|
* @param showToast - Optional boolean to show a toast if the feature flag is disabled - defaults to true
|
||||||
*/
|
*/
|
||||||
export const canAccessFeature = (
|
export const canAccessFeature = (
|
||||||
featureFlag: FeatureFlag,
|
featureFlag: FeatureFlag,
|
||||||
requiredFlagValue: FlagValue = true,
|
requiredFlagValue: FlagValue = true,
|
||||||
redirectUrlOnDisabled?: string,
|
redirectUrlOnDisabled?: string,
|
||||||
|
showToast = true,
|
||||||
): CanActivateFn => {
|
): CanActivateFn => {
|
||||||
return async () => {
|
return async () => {
|
||||||
const configService = inject(ConfigService);
|
const configService = inject(ConfigService);
|
||||||
@@ -36,11 +38,13 @@ export const canAccessFeature = (
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showToast) {
|
||||||
toastService.showToast({
|
toastService.showToast({
|
||||||
variant: "error",
|
variant: "error",
|
||||||
title: null,
|
title: null,
|
||||||
message: i18nService.t("accessDenied"),
|
message: i18nService.t("accessDenied"),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (redirectUrlOnDisabled != null) {
|
if (redirectUrlOnDisabled != null) {
|
||||||
return router.createUrlTree([redirectUrlOnDisabled]);
|
return router.createUrlTree([redirectUrlOnDisabled]);
|
||||||
|
|||||||
Reference in New Issue
Block a user