From cf98e65a3fc7c52e2ff95334a0de80be01f388ca Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Fri, 21 Aug 2020 11:24:47 -0400 Subject: [PATCH] redirect to homepage after signing in --- ui/page/signInVerify/view.jsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ui/page/signInVerify/view.jsx b/ui/page/signInVerify/view.jsx index 49d944d44..610d7016c 100644 --- a/ui/page/signInVerify/view.jsx +++ b/ui/page/signInVerify/view.jsx @@ -1,5 +1,6 @@ // @flow import * as PAGES from 'constants/pages'; +import { SITE_NAME } from 'config'; import React, { useState } from 'react'; import { withRouter } from 'react-router'; import Page from 'component/page'; @@ -10,13 +11,13 @@ import I18nMessage from 'component/i18nMessage'; import Card from 'component/common/card'; type Props = { - history: { push: string => void, location: { search: string } }, + history: { push: string => void, replace: string => void, location: { search: string } }, doToast: ({}) => void, }; function SignInVerifyPage(props: Props) { const { - history: { push, location }, + history: { push, replace, location }, doToast, } = props; const [isAuthenticationSuccess, setIsAuthenticationSuccess] = useState(false); @@ -64,6 +65,13 @@ function SignInVerifyPage(props: Props) { }; }, [needsRecaptcha, captchaLoaded]); + React.useEffect(() => { + if (isAuthenticationSuccess) { + doToast({ message: __('You are now signed in.') }); + replace('/'); + } + }, [isAuthenticationSuccess, replace, doToast]); + function onCaptchaChange(value) { verifyUser(value); } @@ -91,16 +99,10 @@ function SignInVerifyPage(props: Props) {
-

- {isAuthenticationSuccess - ? __('You can now close this tab.') - : needsRecaptcha - ? null - : __('Welcome back! You are automatically being signed in.')} -

+

{needsRecaptcha ? null : __('Welcome back! You are automatically being signed in.')}

{showCaptchaMessage && !isAuthenticationSuccess && (