diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index fb32391a1..eb6f74fcf 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -82,6 +82,7 @@ const TagsFollowingManagePage = lazyImport(() => ); const TagsFollowingPage = lazyImport(() => import('page/tagsFollowing' /* webpackChunkName: "secondary" */)); const TopPage = lazyImport(() => import('page/top' /* webpackChunkName: "secondary" */)); +const UpdatePasswordPage = lazyImport(() => import('page/passwordUpdate' /* webpackChunkName: "passwordUpdate" */)); const Welcome = lazyImport(() => import('page/welcome' /* webpackChunkName: "secondary" */)); const YoutubeSyncPage = lazyImport(() => import('page/youtubeSync' /* webpackChunkName: "secondary" */)); @@ -294,6 +295,7 @@ function AppRouter(props: Props) { + {isAuthenticated && ( - - - + + + )} {/* @if TARGET='app' */} diff --git a/ui/component/settingAccountPassword/view.jsx b/ui/component/settingAccountPassword/view.jsx index b3498c652..cc9561f15 100644 --- a/ui/component/settingAccountPassword/view.jsx +++ b/ui/component/settingAccountPassword/view.jsx @@ -1,8 +1,10 @@ // @flow import React, { useState } from 'react'; +import { useHistory } from 'react-router'; import { FormField, Form } from 'component/common/form'; import Button from 'component/button'; import ErrorText from 'component/common/error-text'; +import SettingsRow from 'component/settingsRow'; import * as PAGES from 'constants/pages'; type Props = { @@ -18,8 +20,11 @@ export default function SettingAccountPassword(props: Props) { const { user, doToast, doUserPasswordSet, passwordSetSuccess, passwordSetError, doClearPasswordEntry } = props; const [oldPassword, setOldPassword] = useState(''); const [newPassword, setNewPassword] = useState(''); - const [isAddingPassword, setIsAddingPassword] = useState(false); const hasPassword = user && user.password_set; + const { goBack } = useHistory(); + + const title = hasPassword ? __('Update Your Password') : __('Add A Password'); + const subtitle = hasPassword ? '' : __('You do not currently have a password set.'); function handleSubmit() { doUserPasswordSet(newPassword, oldPassword); @@ -27,7 +32,7 @@ export default function SettingAccountPassword(props: Props) { React.useEffect(() => { if (passwordSetSuccess) { - setIsAddingPassword(false); + goBack(); doToast({ message: __('Password updated successfully.'), }); @@ -35,10 +40,10 @@ export default function SettingAccountPassword(props: Props) { setOldPassword(''); setNewPassword(''); } - }, [passwordSetSuccess, setOldPassword, setNewPassword, doClearPasswordEntry, doToast]); + }, [passwordSetSuccess, setOldPassword, setNewPassword, doClearPasswordEntry, doToast, goBack]); - return isAddingPassword ? ( - + return ( + {hasPassword && ( ) : ( - setIsAddingPassword(false)} /> + goBack()} /> )} @@ -71,18 +76,6 @@ export default function SettingAccountPassword(props: Props) { {passwordSetError} )} - - ) : ( - - - {__('Password')} - {!hasPassword && {__('You do not currently have a password set.')}} - - setIsAddingPassword(true)} - /> - + ); } diff --git a/ui/constants/pages.js b/ui/constants/pages.js index 8e5a221ae..eb1d836ec 100644 --- a/ui/constants/pages.js +++ b/ui/constants/pages.js @@ -43,6 +43,7 @@ exports.SETTINGS_STRIPE_ACCOUNT = 'settings/tip_account'; exports.SETTINGS_NOTIFICATIONS = 'settings/notifications'; exports.SETTINGS_BLOCKED_MUTED = 'settings/block_and_mute'; exports.SETTINGS_CREATOR = 'settings/creator'; +exports.SETTINGS_UPDATE_PWD = 'settings/update_password'; exports.SHOW = 'show'; exports.ACCOUNT = 'account'; exports.SEARCH = 'search'; diff --git a/ui/page/passwordUpdate/index.js b/ui/page/passwordUpdate/index.js new file mode 100644 index 000000000..40e233027 --- /dev/null +++ b/ui/page/passwordUpdate/index.js @@ -0,0 +1,3 @@ +import PasswordUpdate from './view'; + +export default PasswordUpdate; diff --git a/ui/page/passwordUpdate/view.jsx b/ui/page/passwordUpdate/view.jsx new file mode 100644 index 000000000..380f30095 --- /dev/null +++ b/ui/page/passwordUpdate/view.jsx @@ -0,0 +1,13 @@ +// @flow +import React from 'react'; +import Card from 'component/common/card'; +import Page from 'component/page'; +import SettingAccountPassword from 'component/settingAccountPassword'; + +export default function PasswordUpdate() { + return ( + + } /> + + ); +}
{__('Password')}
{__('You do not currently have a password set.')}