Skip to content

Commit

Permalink
fix: handle redirection loop (coralproject#2662)
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattjoh authored Oct 24, 2019
1 parent 5714f44 commit 4038fcb
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 82 deletions.
30 changes: 17 additions & 13 deletions src/core/client/auth/views/SignIn/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,25 @@ const SignIn: FunctionComponent<SignInForm> = ({
subtitle={<Subtitle />}
>
<Bar>
{
"<title>Sign In</title><subtitle>to join the conversation</subtitle>"
}
<Title>Sign In</Title>
<Subtitle>to join the conversation</Subtitle>
</Bar>
</Localized>
<SubBar>
<Localized
id="signIn-noAccountSignUp"
textlink={<TextLink onClick={onGotoSignUp} href={signUpHref} />}
>
<Typography variant="bodyCopy" container={Flex}>
{"Don't have an account? <textlink>Sign Up</textlink>"}
</Typography>
</Localized>
</SubBar>
{emailEnabled && (
<SubBar>
<Localized
id="signIn-noAccountSignUp"
textlink={<TextLink onClick={onGotoSignUp} href={signUpHref} />}
>
<Typography variant="bodyCopy" container={Flex}>
Don't have an account?{" "}
<TextLink onClick={onGotoSignUp} href={signUpHref}>
Sign Up
</TextLink>
</Typography>
</Localized>
</SubBar>
)}
<Main data-testid="signIn-main">
<HorizontalGutter size="oneAndAHalf">
{error && (
Expand Down
5 changes: 3 additions & 2 deletions src/core/client/auth/views/SignIn/SignInContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ const SignInContainer: FunctionComponent<Props> = ({
// If there's only one enabled auth integration, we should just perform
// the redirect now.
if (
!auth.integrations.local.enabled ||
!auth.integrations.local.targetFilter.stream
!local.error &&
(!auth.integrations.local.enabled ||
!auth.integrations.local.targetFilter.stream)
) {
// Local isn't enabled, so we can look into the rest of the integrations
// now.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ exports[`renders correctly 1`] = `
title={<Title />}
>
<Bar>
&lt;title&gt;Sign In&lt;/title&gt;&lt;subtitle&gt;to join the conversation&lt;/subtitle&gt;
<Title>
Sign In
</Title>
<Subtitle>
to join the conversation
</Subtitle>
</Bar>
</Localized>
<SubBar>
Expand All @@ -32,7 +37,14 @@ exports[`renders correctly 1`] = `
}
variant="bodyCopy"
>
Don't have an account? &lt;textlink&gt;Sign Up&lt;/textlink&gt;
Don't have an account?
<withPropsOnChange(TextLinkProps)
href="/signUp"
onClick={[Function]}
>
Sign Up
</withPropsOnChange(TextLinkProps)>
</ForwardRef(forwardRef)>
</Localized>
</SubBar>
Expand Down Expand Up @@ -70,7 +82,12 @@ exports[`renders error 1`] = `
title={<Title />}
>
<Bar>
&lt;title&gt;Sign In&lt;/title&gt;&lt;subtitle&gt;to join the conversation&lt;/subtitle&gt;
<Title>
Sign In
</Title>
<Subtitle>
to join the conversation
</Subtitle>
</Bar>
</Localized>
<SubBar>
Expand All @@ -92,7 +109,14 @@ exports[`renders error 1`] = `
}
variant="bodyCopy"
>
Don't have an account? &lt;textlink&gt;Sign Up&lt;/textlink&gt;
Don't have an account?
<withPropsOnChange(TextLinkProps)
href="/signUp"
onClick={[Function]}
>
Sign Up
</withPropsOnChange(TextLinkProps)>
</ForwardRef(forwardRef)>
</Localized>
</SubBar>
Expand Down Expand Up @@ -136,32 +160,14 @@ exports[`renders without email login 1`] = `
title={<Title />}
>
<Bar>
&lt;title&gt;Sign In&lt;/title&gt;&lt;subtitle&gt;to join the conversation&lt;/subtitle&gt;
<Title>
Sign In
</Title>
<Subtitle>
to join the conversation
</Subtitle>
</Bar>
</Localized>
<SubBar>
<Localized
id="signIn-noAccountSignUp"
textlink={
<withPropsOnChange(TextLinkProps)
href="/signUp"
onClick={[Function]}
/>
}
>
<ForwardRef(forwardRef)
container={
Object {
"$$typeof": Symbol(react.forward_ref),
"render": [Function],
}
}
variant="bodyCopy"
>
Don't have an account? &lt;textlink&gt;Sign Up&lt;/textlink&gt;
</ForwardRef(forwardRef)>
</Localized>
</SubBar>
<Main
data-testid="signIn-main"
>
Expand Down
30 changes: 17 additions & 13 deletions src/core/client/auth/views/SignUp/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,25 @@ const SignUp: FunctionComponent<Props> = ({
subtitle={<Subtitle />}
>
<Bar>
{
"<title>Sign Up</title><subtitle>to join the conversation</subtitle>"
}
<Title>Sign Up</Title>
<Subtitle>to join the conversation</Subtitle>
</Bar>
</Localized>
<SubBar>
<Localized
id="signUp-accountAvailableSignIn"
textlink={<TextLink onClick={onGotoSignIn} href={signInHref} />}
>
<Typography variant="bodyCopy" container={Flex}>
{"Already have an account? <textlink>Sign In</textlink>"}
</Typography>
</Localized>
</SubBar>
{emailEnabled && (
<SubBar>
<Localized
id="signUp-accountAvailableSignIn"
textlink={<TextLink onClick={onGotoSignIn} href={signInHref} />}
>
<Typography variant="bodyCopy" container={Flex}>
Already have an account?{" "}
<TextLink onClick={onGotoSignIn} href={signInHref}>
Sign In
</TextLink>
</Typography>
</Localized>
</SubBar>
)}
<Main data-testid="signUp-main">
<HorizontalGutter size="oneAndAHalf">
{emailEnabled && <SignUpWithEmailContainer />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ exports[`renders correctly 1`] = `
title={<Title />}
>
<Bar>
&lt;title&gt;Sign Up&lt;/title&gt;&lt;subtitle&gt;to join the conversation&lt;/subtitle&gt;
<Title>
Sign Up
</Title>
<Subtitle>
to join the conversation
</Subtitle>
</Bar>
</Localized>
<SubBar>
Expand All @@ -32,7 +37,14 @@ exports[`renders correctly 1`] = `
}
variant="bodyCopy"
>
Already have an account? &lt;textlink&gt;Sign In&lt;/textlink&gt;
Already have an account?
<withPropsOnChange(TextLinkProps)
href="/signIn"
onClick={[Function]}
>
Sign In
</withPropsOnChange(TextLinkProps)>
</ForwardRef(forwardRef)>
</Localized>
</SubBar>
Expand Down Expand Up @@ -70,32 +82,14 @@ exports[`renders without email sign up 1`] = `
title={<Title />}
>
<Bar>
&lt;title&gt;Sign Up&lt;/title&gt;&lt;subtitle&gt;to join the conversation&lt;/subtitle&gt;
<Title>
Sign Up
</Title>
<Subtitle>
to join the conversation
</Subtitle>
</Bar>
</Localized>
<SubBar>
<Localized
id="signUp-accountAvailableSignIn"
textlink={
<withPropsOnChange(TextLinkProps)
href="/signIn"
onClick={[Function]}
/>
}
>
<ForwardRef(forwardRef)
container={
Object {
"$$typeof": Symbol(react.forward_ref),
"render": [Function],
}
}
variant="bodyCopy"
>
Already have an account? &lt;textlink&gt;Sign In&lt;/textlink&gt;
</ForwardRef(forwardRef)>
</Localized>
</SubBar>
<Main
data-testid="signUp-main"
>
Expand Down

0 comments on commit 4038fcb

Please sign in to comment.