From 4038fcbcd6a6e0431354d6cdb589098945786cd4 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 24 Oct 2019 17:15:53 +0000 Subject: [PATCH] fix: handle redirection loop (#2662) --- src/core/client/auth/views/SignIn/SignIn.tsx | 30 +++++---- .../auth/views/SignIn/SignInContainer.tsx | 5 +- .../SignIn/__snapshots__/SignIn.spec.tsx.snap | 62 ++++++++++--------- src/core/client/auth/views/SignUp/SignUp.tsx | 30 +++++---- .../SignUp/__snapshots__/SignUp.spec.tsx.snap | 46 ++++++-------- 5 files changed, 91 insertions(+), 82 deletions(-) diff --git a/src/core/client/auth/views/SignIn/SignIn.tsx b/src/core/client/auth/views/SignIn/SignIn.tsx index 82cf36ea0..8a9902cd4 100644 --- a/src/core/client/auth/views/SignIn/SignIn.tsx +++ b/src/core/client/auth/views/SignIn/SignIn.tsx @@ -53,21 +53,25 @@ const SignIn: FunctionComponent = ({ subtitle={} > - { - "Sign Into join the conversation" - } + Sign In + to join the conversation - - } - > - - {"Don't have an account? Sign Up"} - - - + {emailEnabled && ( + + } + > + + Don't have an account?{" "} + + Sign Up + + + + + )}
{error && ( diff --git a/src/core/client/auth/views/SignIn/SignInContainer.tsx b/src/core/client/auth/views/SignIn/SignInContainer.tsx index 26255bad3..a4e59229c 100644 --- a/src/core/client/auth/views/SignIn/SignInContainer.tsx +++ b/src/core/client/auth/views/SignIn/SignInContainer.tsx @@ -51,8 +51,9 @@ const SignInContainer: FunctionComponent = ({ // 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. diff --git a/src/core/client/auth/views/SignIn/__snapshots__/SignIn.spec.tsx.snap b/src/core/client/auth/views/SignIn/__snapshots__/SignIn.spec.tsx.snap index a6aec8be5..bf83fe17b 100644 --- a/src/core/client/auth/views/SignIn/__snapshots__/SignIn.spec.tsx.snap +++ b/src/core/client/auth/views/SignIn/__snapshots__/SignIn.spec.tsx.snap @@ -10,7 +10,12 @@ exports[`renders correctly 1`] = ` title={} > <Bar> - <title>Sign In</title><subtitle>to join the conversation</subtitle> + <Title> + Sign In + + + to join the conversation + @@ -32,7 +37,14 @@ exports[`renders correctly 1`] = ` } variant="bodyCopy" > - Don't have an account? <textlink>Sign Up</textlink> + Don't have an account? + + + Sign Up + @@ -70,7 +82,12 @@ exports[`renders error 1`] = ` title={} > <Bar> - <title>Sign In</title><subtitle>to join the conversation</subtitle> + <Title> + Sign In + + + to join the conversation + @@ -92,7 +109,14 @@ exports[`renders error 1`] = ` } variant="bodyCopy" > - Don't have an account? <textlink>Sign Up</textlink> + Don't have an account? + + + Sign Up + @@ -136,32 +160,14 @@ exports[`renders without email login 1`] = ` title={} > <Bar> - <title>Sign In</title><subtitle>to join the conversation</subtitle> + <Title> + Sign In + + + to join the conversation + - - - } - > - - Don't have an account? <textlink>Sign Up</textlink> - - -
diff --git a/src/core/client/auth/views/SignUp/SignUp.tsx b/src/core/client/auth/views/SignUp/SignUp.tsx index f819b3a67..fb983f6a4 100644 --- a/src/core/client/auth/views/SignUp/SignUp.tsx +++ b/src/core/client/auth/views/SignUp/SignUp.tsx @@ -50,21 +50,25 @@ const SignUp: FunctionComponent = ({ subtitle={} > - { - "Sign Upto join the conversation" - } + Sign Up + to join the conversation - - } - > - - {"Already have an account? Sign In"} - - - + {emailEnabled && ( + + } + > + + Already have an account?{" "} + + Sign In + + + + + )}
{emailEnabled && } diff --git a/src/core/client/auth/views/SignUp/__snapshots__/SignUp.spec.tsx.snap b/src/core/client/auth/views/SignUp/__snapshots__/SignUp.spec.tsx.snap index 419fba3d0..f2a4822dc 100644 --- a/src/core/client/auth/views/SignUp/__snapshots__/SignUp.spec.tsx.snap +++ b/src/core/client/auth/views/SignUp/__snapshots__/SignUp.spec.tsx.snap @@ -10,7 +10,12 @@ exports[`renders correctly 1`] = ` title={} > <Bar> - <title>Sign Up</title><subtitle>to join the conversation</subtitle> + <Title> + Sign Up + + + to join the conversation + @@ -32,7 +37,14 @@ exports[`renders correctly 1`] = ` } variant="bodyCopy" > - Already have an account? <textlink>Sign In</textlink> + Already have an account? + + + Sign In + @@ -70,32 +82,14 @@ exports[`renders without email sign up 1`] = ` title={} > <Bar> - <title>Sign Up</title><subtitle>to join the conversation</subtitle> + <Title> + Sign Up + + + to join the conversation + - - - } - > - - Already have an account? <textlink>Sign In</textlink> - - -