diff --git a/server/api/team.js b/server/api/team.js index d3c7561c..ab62d705 100644 --- a/server/api/team.js +++ b/server/api/team.js @@ -19,7 +19,7 @@ router.post('team.update', auth(), async ctx => { const team = await Team.findById(user.teamId); authorize(user, 'update', team); - if (process.env.SUBDOMAINS_ENABLED) { + if (process.env.SUBDOMAINS_ENABLED === 'true') { team.subdomain = subdomain === '' ? null : subdomain; } diff --git a/server/middlewares/authentication.js b/server/middlewares/authentication.js index d1c2d346..eeea0971 100644 --- a/server/middlewares/authentication.js +++ b/server/middlewares/authentication.js @@ -110,7 +110,7 @@ export default function auth(options?: { required?: boolean } = {}) { // set a transfer cookie for the access token itself and redirect // to the teams subdomain if subdomains are enabled - if (process.env.SUBDOMAINS_ENABLED && team.subdomain) { + if (process.env.SUBDOMAINS_ENABLED === 'true' && team.subdomain) { // get any existing sessions (teams signed in) and add this team const existing = JSON.parse(ctx.cookies.get('sessions') || '{}'); const sessions = JSON.stringify({ diff --git a/server/models/Team.js b/server/models/Team.js index 777bc145..265e566b 100644 --- a/server/models/Team.js +++ b/server/models/Team.js @@ -45,7 +45,7 @@ const Team = sequelize.define( { getterMethods: { url() { - if (!this.subdomain || !process.env.SUBDOMAINS_ENABLED) { + if (!this.subdomain || process.env.SUBDOMAINS_ENABLED !== 'true') { return process.env.URL; } diff --git a/server/pages/components/Layout.js b/server/pages/components/Layout.js index 42a18567..3b913d9d 100644 --- a/server/pages/components/Layout.js +++ b/server/pages/components/Layout.js @@ -15,10 +15,11 @@ export const screenshotUrl = `${process.env.URL}/screenshot.png`; type Props = { children?: React.Node, - sessions?: Object, + sessions: Object, + loggedIn: boolean, }; -function Layout({ children, sessions }: Props) { +function Layout({ children, loggedIn, sessions }: Props) { return (
@@ -66,7 +67,7 @@ function Layout({ children, sessions }: Props) { {'{{CSS}}'} -