From df23cb8cddf04cfcb7d4ce7a64d33cdfd1df1150 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Thu, 6 Nov 2025 00:12:50 +0800 Subject: [PATCH] do not refresh token when enter verify email / reset password / oauth 2.0 callback page --- src/DesktopApp.vue | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/DesktopApp.vue b/src/DesktopApp.vue index 22f576a6..4fb4bfc5 100644 --- a/src/DesktopApp.vue +++ b/src/DesktopApp.vue @@ -46,6 +46,28 @@ const userStore = useUserStore(); const tokensStore = useTokensStore(); const exchangeRatesStore = useExchangeRatesStore(); +const initialRoutePath: string = (() => { + if (!window.location.hash) { + return '/'; + } + + const hash = window.location.hash; + const hashIndex = hash.indexOf('#/'); + + if (hashIndex < 0) { + return '/'; + } + + const routePath = hash.substring(hashIndex + 1); + const queryIndex = routePath.indexOf('?'); + + if (queryIndex < 0) { + return routePath; + } + + return routePath.substring(0, queryIndex); +})(); + const showNotification = ref(false); const currentNotificationContent = computed(() => rootStore.currentNotification); @@ -84,7 +106,7 @@ settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings); setExpenseAndIncomeAmountColor(userStore.currentUserExpenseAmountColor, userStore.currentUserIncomeAmountColor); -if (isUserLogined()) { +if (isUserLogined() && initialRoutePath !== '/verify_email' && initialRoutePath !== '/resetpassword' && initialRoutePath !== '/oauth2_callback') { if (!settingsStore.appSettings.applicationLock || isUserUnlocked()) { // refresh token if user is logined tokensStore.refreshTokenAndRevokeOldToken().then(response => {