From 4221c9a50fba6140c3a41e169fced03015e530a2 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 16 May 2026 19:07:10 +0200 Subject: [PATCH] fix: strip Stalwart master-user '%' suffix from displayed account --- stores/auth-store.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/stores/auth-store.ts b/stores/auth-store.ts index e404d059..8c09f440 100644 --- a/stores/auth-store.ts +++ b/stores/auth-store.ts @@ -1266,14 +1266,22 @@ export const useAuthStore = create()( if (restore.ok) { const data = await restore.json(); if (data?.serverUrl && data?.username && data?.password) { + // Stalwart master-user impersonation uses "target%master" as + // the auth username. The full string must be preserved for + // JMAP auth, but the user-facing display (avatar, switcher, + // sign-out copy) should only show the target mailbox. + const fullUsername: string = data.username; + const displayMailbox = fullUsername.includes('%') + ? fullUsername.split('%', 1)[0] + : fullUsername; accountStore.addAccount({ - label: data.username, + label: displayMailbox, serverUrl: data.serverUrl, - username: data.username, + username: fullUsername, authMode: 'basic', rememberMe: true, - displayName: data.username, - email: data.username, + displayName: displayMailbox, + email: displayMailbox, lastLoginAt: Date.now(), isConnected: false, hasError: false,