From d4e64993428a04c7e1cbb6eb61c507dd4f925b77 Mon Sep 17 00:00:00 2001 From: Karim El Jazzar <122301442+JazzarKarim@users.noreply.github.com> Date: Mon, 16 Dec 2024 15:29:50 -0800 Subject: [PATCH] 24226 - Redirect external links (#3179) --- auth-web/src/routes/index.ts | 5 +++++ auth-web/src/util/navigation.ts | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/auth-web/src/routes/index.ts b/auth-web/src/routes/index.ts index ae1deb2448..33a2d86dba 100644 --- a/auth-web/src/routes/index.ts +++ b/auth-web/src/routes/index.ts @@ -16,6 +16,7 @@ import Router from 'vue-router' import { User } from '@/models/user' import Vue from 'vue' import { getRoutes } from './router' +import { handleExternalLinkRedirect } from '@/util/navigation' import store from '@/stores/vuex' import { useOrgStore } from '@/stores/org' import { useUserStore } from '@/stores/user' @@ -173,6 +174,10 @@ router.beforeEach(async (to, from, next) => { return next({ path: `/${Pages.UPDATE_ACCOUNT}` }) } } + + if (handleExternalLinkRedirect(to.fullPath)) { + return + } next() } }) diff --git a/auth-web/src/util/navigation.ts b/auth-web/src/util/navigation.ts index 4741adf83b..740835f422 100644 --- a/auth-web/src/util/navigation.ts +++ b/auth-web/src/util/navigation.ts @@ -55,3 +55,12 @@ export const goToFormPage = (entityType): void => { export const goToSocieties = (): void => { window.open(appendAccountId(ConfigHelper.getSocietiesUrl()), '_blank') } + +export const handleExternalLinkRedirect = (path: string): boolean => { + if (path.includes('/http')) { + const cleanPath = path.replace(/^\//, '') + window.location.href = cleanPath + return true + } + return false +}