From 25a6a64130c0e7ec1927c3e1d08aaf7176447ef6 Mon Sep 17 00:00:00 2001 From: Prospector <6166773+Prospector@users.noreply.github.com> Date: Fri, 3 Apr 2026 14:02:01 -0700 Subject: [PATCH] add sign in redirect path --- apps/frontend/src/composables/auth.js | 17 ++++++++++++++++- apps/frontend/src/layouts/default.vue | 6 ++++-- apps/frontend/src/pages/[type]/[id].vue | 16 +++++++++++----- .../src/pages/[type]/[id]/settings/versions.vue | 6 +++++- .../src/pages/[type]/[id]/version/[version].vue | 4 +++- .../frontend/src/pages/[type]/[id]/versions.vue | 5 ++++- apps/frontend/src/pages/user/[id].vue | 4 +++- apps/frontend/src/providers/setup/auth.ts | 5 ++++- apps/frontend/src/utils/report-helpers.ts | 9 +++++---- 9 files changed, 55 insertions(+), 17 deletions(-) diff --git a/apps/frontend/src/composables/auth.js b/apps/frontend/src/composables/auth.js index 736756d7c2..e69d6a4d52 100644 --- a/apps/frontend/src/composables/auth.js +++ b/apps/frontend/src/composables/auth.js @@ -104,13 +104,28 @@ export const initAuth = async (oldToken = null) => { return auth } +export const getSignInRedirectPath = (route) => { + const fullPath = route.fullPath + if (fullPath === '/auth' || fullPath.startsWith('/auth/')) { + return '/dashboard' + } + return fullPath +} + +export const getSignInRouteObj = (route, redirectOverride) => ({ + path: '/auth/sign-in', + query: { + redirect: redirectOverride ?? getSignInRedirectPath(route), + }, +}) + export const getAuthUrl = (provider, redirect = '/dashboard') => { const config = useRuntimeConfig() const route = useNativeRoute() const fullURL = route.query.launcher ? getLauncherRedirectUrl(route) - : `${config.public.siteUrl}/auth/sign-in?redirect=${redirect}` + : `${config.public.siteUrl}/auth/sign-in?redirect=${encodeURIComponent(redirect)}` return `${config.public.apiBaseUrl}auth/init?provider=${provider}&url=${encodeURIComponent(fullURL)}` } diff --git a/apps/frontend/src/layouts/default.vue b/apps/frontend/src/layouts/default.vue index 6ef59f08c5..99c8b33a81 100644 --- a/apps/frontend/src/layouts/default.vue +++ b/apps/frontend/src/layouts/default.vue @@ -501,7 +501,7 @@