Fix OAuth login on custom domains (#320)

This commit is contained in:
Riccardo Graziosi
2024-03-28 12:29:54 +01:00
committed by GitHub
parent b63956a173
commit e887bca9cf
9 changed files with 42 additions and 25 deletions

View File

@@ -37,6 +37,7 @@ export interface ISiteSettingsGeneralForm {
interface Props {
originForm: ISiteSettingsGeneralForm;
boards: IBoardJSON[];
isMultiTenant: boolean;
authenticityToken: string;
areUpdating: boolean;
@@ -61,6 +62,7 @@ interface Props {
const GeneralSiteSettingsP = ({
originForm,
boards,
isMultiTenant,
authenticityToken,
areUpdating,
@@ -195,19 +197,23 @@ const GeneralSiteSettingsP = ({
</select>
</div>
<div className="formGroup">
<label htmlFor="customDomain">{ getLabel('tenant', 'custom_domain') }</label>
<input
{...register('customDomain')}
id="customDomain"
className="formControl"
/>
{
originForm.customDomain !== customDomain && customDomain !== '' &&
<div style={{marginTop: 16}}>
<SmallMutedText>
{ I18n.t('site_settings.general.custom_domain_help', { domain: customDomain }) }
</SmallMutedText>
{ isMultiTenant &&
<div className="formGroup">
<label htmlFor="customDomain">{ getLabel('tenant', 'custom_domain') }</label>
<input
{...register('customDomain')}
id="customDomain"
className="formControl"
/>
{
originForm.customDomain !== customDomain && customDomain !== '' &&
<div style={{marginTop: 16}}>
<SmallMutedText>
{ I18n.t('site_settings.general.custom_domain_help', { domain: customDomain }) }
</SmallMutedText>
</div>
}
<div style={{marginTop: 8}}>
<ActionLink
onClick={() => window.open('https://docs.astuto.io/custom-domain', '_blank')}
icon={<LearnMoreIcon />}
@@ -215,8 +221,8 @@ const GeneralSiteSettingsP = ({
{I18n.t('site_settings.general.custom_domain_learn_more')}
</ActionLink>
</div>
}
</div>
</div>
}
<br />
<h4>{ I18n.t('site_settings.general.subtitle_header') }</h4>

View File

@@ -11,6 +11,7 @@ import { ISiteSettingsGeneralForm } from './GeneralSiteSettingsP';
interface Props {
originForm: ISiteSettingsGeneralForm;
boards: IBoardJSON[];
isMultiTenant: boolean;
authenticityToken: string;
}
@@ -29,6 +30,7 @@ class GeneralSiteSettingsRoot extends React.Component<Props> {
<GeneralSiteSettings
originForm={this.props.originForm}
boards={this.props.boards}
isMultiTenant={this.props.isMultiTenant}
authenticityToken={this.props.authenticityToken}
/>
</Provider>

View File

@@ -7,11 +7,15 @@ interface Props {
oAuthLogo?: string;
oAuthReason: string;
isSignUp?: boolean;
href?: string;
}
const OAuthProviderLink = ({ oAuthId, oAuthName, oAuthLogo, oAuthReason, isSignUp = false }: Props) => (
const OAuthProviderLink = ({ oAuthId, oAuthName, oAuthLogo, oAuthReason, isSignUp = false, href = undefined }: Props) => (
<button
onClick={() => window.location.href = `/o_auths/${oAuthId}/start?reason=${oAuthReason}`}
onClick={
() => { window.location.href = href ? href : `/o_auths/${oAuthId}/start?reason=${oAuthReason}` }
}
className={`oauthProviderBtn oauthProvider${oAuthName.replace(' ', '')}`}
>
{ oAuthLogo && oAuthLogo.length > 0 && <img src={oAuthLogo} alt={oAuthName} width={28} height={28} /> }