From aa7b39eb9cada77179a4b60be18428a29096aaec Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 20 Aug 2022 00:18:38 +0530 Subject: [PATCH 1/2] refactor(gui-v2): navigate to signup page if first user Signed-off-by: Pranav C --- packages/nc-gui-v2/middleware/auth.global.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/nc-gui-v2/middleware/auth.global.ts b/packages/nc-gui-v2/middleware/auth.global.ts index 8c85c53571..785791011c 100644 --- a/packages/nc-gui-v2/middleware/auth.global.ts +++ b/packages/nc-gui-v2/middleware/auth.global.ts @@ -33,6 +33,9 @@ export default defineNuxtRouteMiddleware((to, from) => { /** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */ if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) { + if (state.appInfo?.value?.firstUser) { + return navigateTo('/signup') + } return navigateTo('/signin') } else if (to.meta.requiresAuth === false && state.signedIn.value) { /** From 11905af69b75d0cbfa0fb22c2b9d71601355b711 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sun, 21 Aug 2022 12:30:19 +0530 Subject: [PATCH 2/2] refactor(gui-v2): corrections Signed-off-by: Pranav C --- packages/nc-gui-v2/middleware/auth.global.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui-v2/middleware/auth.global.ts b/packages/nc-gui-v2/middleware/auth.global.ts index 785791011c..30d1b805f8 100644 --- a/packages/nc-gui-v2/middleware/auth.global.ts +++ b/packages/nc-gui-v2/middleware/auth.global.ts @@ -33,9 +33,11 @@ export default defineNuxtRouteMiddleware((to, from) => { /** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */ if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) { - if (state.appInfo?.value?.firstUser) { + /** If this is the first usern navigate to signup page directly */ + if (state.appInfo.value.firstUser) { return navigateTo('/signup') } + return navigateTo('/signin') } else if (to.meta.requiresAuth === false && state.signedIn.value) { /**