From a1f0e485b54403df34d50dc7874201165a7b8c78 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Wed, 13 Nov 2019 19:33:36 -0500 Subject: [PATCH] add sign in flow to lbry.tv --- package.json | 1 + ui/component/header/view.jsx | 37 ++++++++++-------- ui/component/router/view.jsx | 2 + ui/constants/pages.js | 1 + ui/page/signInVerify/index.js | 13 +++++++ ui/page/signInVerify/view.jsx | 72 +++++++++++++++++++++++++++++++++++ yarn.lock | 18 ++++++++- 7 files changed, 127 insertions(+), 17 deletions(-) create mode 100644 ui/page/signInVerify/index.js create mode 100644 ui/page/signInVerify/view.jsx diff --git a/package.json b/package.json index 33cf82a28..a51a9374f 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,7 @@ "react-dom": "^16.8.2", "react-draggable": "^3.3.0", "react-ga": "^2.5.7", + "react-google-recaptcha": "^2.0.1", "react-hot-loader": "^4.11.1", "react-modal": "^3.1.7", "react-paginate": "^5.2.1", diff --git a/ui/component/header/view.jsx b/ui/component/header/view.jsx index 115e9676e..10e7c6a7b 100644 --- a/ui/component/header/view.jsx +++ b/ui/component/header/view.jsx @@ -44,9 +44,14 @@ const Header = (props: Props) => { } = props; const authenticated = Boolean(email); + //on the verify page don't let anyone escape other than by closing the tab to keep session data consistent + const isVerifyPage = history.location.pathname.includes(PAGES.AUTH_VERIFY); + // Sign out if they click the "x" when they are on the password prompt const authHeaderAction = syncError ? { onClick: signOut } : { navigate: '/' }; - const homeButtonNavigationProps = authHeader ? authHeaderAction : { navigate: '/' }; + const homeButtonNavigationProps = isVerifyPage ? + { } : + authHeader ? authHeaderAction : { navigate: '/' }; const closeButtonNavigationProps = authHeader ? authHeaderAction : { onClick: () => history.goBack() }; function handleThemeToggle() { @@ -111,7 +116,7 @@ const Header = (props: Props) => { )} {/* @endif */} - {!authHeader && } + {!authHeader && } {!authHeader ? ( @@ -122,37 +127,37 @@ const Header = (props: Props) => { {getWalletTitle()} history.push(`/$/${PAGES.WALLET}`)}> - + {__('Wallet')} history.push(`/$/${PAGES.REWARDS}`)}> - + {__('Rewards')} - + history.push(`/$/${PAGES.ACCOUNT}`)}> - + {__('Overview')} history.push(`/$/${PAGES.PUBLISH}`)}> - + {__('Publish')} {authenticated ? ( - + {__('Sign Out')} ) : ( history.push(`/$/${PAGES.AUTH}`)}> - + {__('Sign In')} )} @@ -161,33 +166,33 @@ const Header = (props: Props) => { - + history.push(`/$/${PAGES.SETTINGS}`)}> - + {__('Settings')} history.push(`/$/${PAGES.HELP}`)}> - + {__('Help')} - + {currentTheme === 'light' ? __('Dark') : __('Light')} ) : ( -