fix: Custom domain authentication, regressed in:

https://github.com/outline/outline/pull/3652
This commit is contained in:
Tom Moor
2022-06-22 21:58:05 +02:00
parent 51230a55e5
commit 50456c3b89

View File

@@ -2,9 +2,11 @@ import { EmailIcon } from "outline-icons";
import * as React from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { parseDomain } from "@shared/utils/domains";
import AuthLogo from "~/components/AuthLogo";
import ButtonLarge from "~/components/ButtonLarge";
import InputLarge from "~/components/InputLarge";
import env from "~/env";
import { client } from "~/utils/ApiClient";
type Props = {
@@ -87,10 +89,16 @@ function AuthenticationProvider(props: Props) {
);
}
// If we're on a custom domain then the auth must point to the root
// app.getoutline.com for authentication so that the state cookie can be set
// and read.
const isCustomDomain = parseDomain(window.location.origin).custom;
const href = `${isCustomDomain ? env.URL : ""}${authUrl}`;
return (
<Wrapper>
<ButtonLarge
onClick={() => (window.location.href = authUrl)}
onClick={() => (window.location.href = href)}
icon={<AuthLogo providerName={id} />}
fullwidth
>