fix(auth): Allow accept-invite on subdomains without redirect to login

Don't redirect unauthenticated users to login when accessing public paths
like /accept-invite, /verify-email, or /tenant-onboard on subdomains.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-03 15:28:17 -05:00
parent 39a376b39b
commit 04bb9e3c14

View File

@@ -297,7 +297,12 @@ const AppContent: React.FC = () => {
: currentHostname; : currentHostname;
const isRootDomainForUnauthUser = currentHostname === baseDomain || currentHostname === 'localhost'; const isRootDomainForUnauthUser = currentHostname === baseDomain || currentHostname === 'localhost';
if (!isRootDomainForUnauthUser) { // Don't redirect for certain public paths that should work on any subdomain
const publicPaths = ['/accept-invite', '/verify-email', '/tenant-onboard'];
const currentPath = window.location.pathname;
const isPublicPath = publicPaths.some(path => currentPath.startsWith(path));
if (!isRootDomainForUnauthUser && !isPublicPath) {
// Redirect to root domain login (preserve port) // Redirect to root domain login (preserve port)
const protocol = window.location.protocol; const protocol = window.location.protocol;
const port = window.location.port ? `:${window.location.port}` : ''; const port = window.location.port ? `:${window.location.port}` : '';