feat: implement path prefix handling for OAuth and login redirects

This commit is contained in:
Linus Rath
2026-03-24 14:44:42 +01:00
parent de26e6da2e
commit 13010c158d
5 changed files with 64 additions and 13 deletions
+4 -4
View File
@@ -12,7 +12,7 @@ import { useAccountStore } from './account-store';
import { fetchConfig } from '@/hooks/use-config';
import { debug } from '@/lib/debug';
import { generateAccountId } from '@/lib/account-utils';
import { replaceWindowLocation } from '@/lib/browser-navigation';
import { replaceWindowLocation, getPathPrefix, getLocaleFromPath } from '@/lib/browser-navigation';
import { notifyParent } from '@/lib/iframe-bridge';
import { snapshotAccount, restoreAccount, clearAllStores, evictAccount, evictAll } from '@/lib/account-state-manager';
import type { Identity } from '@/lib/jmap/types';
@@ -107,9 +107,9 @@ function loadIdentities(rawIdentities: Identity[], username: string): { identiti
function getLocaleLoginPath(): string {
if (typeof window === 'undefined') return '/en/login';
const segments = window.location.pathname.split('/').filter(Boolean);
const locale = segments[0] || 'en';
return `/${locale}/login`;
const prefix = getPathPrefix();
const locale = getLocaleFromPath();
return `${prefix}/${locale}/login`;
}
function saveRedirectAfterLogin(): void {