diff --git a/app/stores/AuthStore.ts b/app/stores/AuthStore.ts index fd6fceec2a30..6ab3efc2558f 100644 --- a/app/stores/AuthStore.ts +++ b/app/stores/AuthStore.ts @@ -352,10 +352,9 @@ export default class AuthStore extends Store { } if (userInitiated) { - // Rewrite "." → "." so we land on the portal - // (outside ForwardAuth) instead of Outline's own root, which would silently re-auth. - const smbName = window.env.SMB_NAME ?? "moneta"; - const portalHost = window.location.hostname.replace(/^[^.]*\./, `${smbName}.`); + // Rewrite "-." → "." so we land on the + // portal (outside ForwardAuth) instead of Outline's own root, which would silently re-auth. + const portalHost = window.location.hostname.replace(/^([^-]+)-[^.]+\.(.+)/, "$1.$2"); this.logoutRedirectUri = `${window.location.protocol}//${portalHost}`; }