From b6f9b0e6d4a2e0cc04e52cc9616ff84f4e8f9804 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Wed, 22 Jun 2022 12:32:17 -0400 Subject: [PATCH] Add token to help page (internal) (#1737) --- ui/page/help/index.js | 2 ++ ui/page/help/view.jsx | 28 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ui/page/help/index.js b/ui/page/help/index.js index 3e9785f4b..927762856 100644 --- a/ui/page/help/index.js +++ b/ui/page/help/index.js @@ -2,9 +2,11 @@ import HelpPage from './view'; import { connect } from 'react-redux'; import { doOpenModal } from 'redux/actions/app'; import { selectHomepageAnnouncement } from 'redux/selectors/settings'; +import { selectUser } from 'redux/selectors/user'; const select = (state) => ({ announcement: selectHomepageAnnouncement(state), + user: selectUser(state), }); const perform = { diff --git a/ui/page/help/view.jsx b/ui/page/help/view.jsx index 9f35288cf..6a5508da5 100644 --- a/ui/page/help/view.jsx +++ b/ui/page/help/view.jsx @@ -6,16 +6,23 @@ import Button from 'component/button'; import Page from 'component/page'; import Card from 'component/common/card'; import I18nMessage from 'component/i18nMessage'; +import { getAuthToken } from 'util/saved-passwords'; +import CopyableText from 'component/copyableText'; import * as MODALS from 'constants/modal_types'; type Props = { announcement: string, doOpenModal: (string, ?{}) => void, + user: any, }; export default function HelpPage(props: Props) { - const { announcement, doOpenModal } = props; + const { announcement, doOpenModal, user } = props; + + const canViewToken = process.env.ENABLE_WIP_FEATURES || (user && user.internal_feature); + + const authToken = canViewToken && getAuthToken(); return ( @@ -94,6 +101,25 @@ export default function HelpPage(props: Props) { } /> + + {canViewToken && authToken && ( + + + + } + /> + )} ); }