Add token to help page (internal) (#1737)
This commit is contained in:
parent
d1958d3775
commit
b6f9b0e6d4
2 changed files with 29 additions and 1 deletions
|
@ -2,9 +2,11 @@ import HelpPage from './view';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doOpenModal } from 'redux/actions/app';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { selectHomepageAnnouncement } from 'redux/selectors/settings';
|
import { selectHomepageAnnouncement } from 'redux/selectors/settings';
|
||||||
|
import { selectUser } from 'redux/selectors/user';
|
||||||
|
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
announcement: selectHomepageAnnouncement(state),
|
announcement: selectHomepageAnnouncement(state),
|
||||||
|
user: selectUser(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = {
|
const perform = {
|
||||||
|
|
|
@ -6,16 +6,23 @@ import Button from 'component/button';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
import Card from 'component/common/card';
|
import Card from 'component/common/card';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
|
import { getAuthToken } from 'util/saved-passwords';
|
||||||
|
import CopyableText from 'component/copyableText';
|
||||||
|
|
||||||
import * as MODALS from 'constants/modal_types';
|
import * as MODALS from 'constants/modal_types';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
announcement: string,
|
announcement: string,
|
||||||
doOpenModal: (string, ?{}) => void,
|
doOpenModal: (string, ?{}) => void,
|
||||||
|
user: any,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function HelpPage(props: Props) {
|
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 (
|
return (
|
||||||
<Page className="card-stack">
|
<Page className="card-stack">
|
||||||
|
@ -94,6 +101,25 @@ export default function HelpPage(props: Props) {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{canViewToken && authToken && (
|
||||||
|
<Card
|
||||||
|
className="section"
|
||||||
|
title={__('Your Access Token')}
|
||||||
|
actions={
|
||||||
|
<>
|
||||||
|
<CopyableText
|
||||||
|
primaryButton
|
||||||
|
enableInputMask
|
||||||
|
name="access-token"
|
||||||
|
label={__('Authentication Token - do not share, this works like a password!')}
|
||||||
|
copyable={authToken}
|
||||||
|
snackMessage={__('Copied token')}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue