Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat(router-guard): set route guard for activation/* and confirm-new-email

haitao(lj)e2cf6d2b3d8f
diff --git a/ui/src/router/guarder.ts b/ui/src/router/guarder.ts
index 8fd8a69b..8c5bf7c2 100644
--- a/ui/src/router/guarder.ts
+++ b/ui/src/router/guarder.ts
@@ -2,7 +2,6 @@ import {
pullLoggedUser,
isLoggedAndNormal,
isAdminLogged,
- isLogged,
isNotLogged,
isNotLoggedOrNormal,
isLoggedAndInactive,
@@ -14,9 +13,6 @@ const RouteGuarder = {
base: async () => {
return isNotLoggedOrNormal();
},
- logged: async () => {
- return isLogged();
- },
notLogged: async () => {
return isNotLogged();
},
diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts
index ad964c38..5abf7e4b 100644
--- a/ui/src/router/routes.ts
+++ b/ui/src/router/routes.ts
@@ -126,9 +126,11 @@ const routes: RouteNode[] = [
page: 'pages/Users/PasswordReset',
guard: RouteGuarder.loggedAndNormal,
},
+ // TODO: guard '/account-activation/*', '/users/confirm-new-email'
{
path: 'users/account-activation',
page: 'pages/Users/ActiveEmail',
+ guard: RouteGuarder.loggedAndInactive,
},
{
path: 'users/account-activation/success',
@@ -145,6 +147,7 @@ const routes: RouteNode[] = [
{
path: '/users/account-suspended',
page: 'pages/Users/Suspended',
+ guard: RouteGuarder.loggedAndSuspended,
},
// for admin
{