Web: People: get tfa backup codes
This commit is contained in:
parent
c8d73981a4
commit
5f0f262adf
@ -9,8 +9,15 @@ import ModalDialogContainer from "../ModalDialogContainer";
|
|||||||
class BackupCodesDialogComponent extends React.Component {
|
class BackupCodesDialogComponent extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
this.state = { backupCodes: this.props.getBackupCodes() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getNewBackupCodes = () => {
|
||||||
|
const { getBackupCodes } = this.props;
|
||||||
|
const newCodes = getBackupCodes();
|
||||||
|
this.setState({ backupCodes: newCodes });
|
||||||
|
};
|
||||||
|
|
||||||
printPage = () => {
|
printPage = () => {
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
const printContent = document.getElementById("backup-codes-print-content");
|
const printContent = document.getElementById("backup-codes-print-content");
|
||||||
@ -29,9 +36,10 @@ class BackupCodesDialogComponent extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
console.log("Render BackupCodesDialog");
|
console.log("Render BackupCodesDialog");
|
||||||
|
const { backupCodes } = this.state;
|
||||||
const { t, visible, onClose } = this.props;
|
const { t, visible, onClose } = this.props;
|
||||||
const count = 5; //TODO: get count from api
|
const count = 5; //TODO: get count from api
|
||||||
const codes = ["qdf45g", "fg56dfg", "ugi8fm", "gfuti8f", "fkuidop"]; //TODO: get codes from api
|
//const codes = ["qdf45g", "fg56dfg", "ugi8fm", "gfuti8f", "fkuidop"]; //TODO: get codes from api
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalDialogContainer>
|
<ModalDialogContainer>
|
||||||
@ -55,7 +63,7 @@ class BackupCodesDialogComponent extends React.Component {
|
|||||||
</Text>
|
</Text>
|
||||||
</Trans>
|
</Trans>
|
||||||
<Text className="text-dialog" isBold={true}>
|
<Text className="text-dialog" isBold={true}>
|
||||||
{codes.map((item) => {
|
{backupCodes.map((item) => {
|
||||||
return (
|
return (
|
||||||
<strong key={item}>
|
<strong key={item}>
|
||||||
{item} <br />
|
{item} <br />
|
||||||
@ -79,6 +87,7 @@ class BackupCodesDialogComponent extends React.Component {
|
|||||||
label={t("RequestNewButton")}
|
label={t("RequestNewButton")}
|
||||||
size="medium"
|
size="medium"
|
||||||
primary={false}
|
primary={false}
|
||||||
|
onClick={this.getNewBackupCodes}
|
||||||
/>
|
/>
|
||||||
</ModalDialog.Footer>
|
</ModalDialog.Footer>
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
@ -94,6 +103,7 @@ const BackupCodesDialog = withTranslation("BackupCodesDialog")(
|
|||||||
BackupCodesDialog.propTypes = {
|
BackupCodesDialog.propTypes = {
|
||||||
visible: PropTypes.bool.isRequired,
|
visible: PropTypes.bool.isRequired,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
|
getBackupCodes: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BackupCodesDialog;
|
export default BackupCodesDialog;
|
||||||
|
@ -443,6 +443,7 @@ class SectionBodyContent extends React.PureComponent {
|
|||||||
<BackupCodesDialog
|
<BackupCodesDialog
|
||||||
visible={backupCodesDialogVisible}
|
visible={backupCodesDialogVisible}
|
||||||
onClose={this.toggleBackupCodesDialogVisible}
|
onClose={this.toggleBackupCodesDialogVisible}
|
||||||
|
getBackupCodes={this.props.getBackupCodes}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</ProfileWrapper>
|
</ProfileWrapper>
|
||||||
@ -466,5 +467,6 @@ export default withRouter(
|
|||||||
setProviders: peopleStore.usersStore.setProviders,
|
setProviders: peopleStore.usersStore.setProviders,
|
||||||
getOAuthToken: auth.settingsStore.getOAuthToken,
|
getOAuthToken: auth.settingsStore.getOAuthToken,
|
||||||
getLoginLink: auth.settingsStore.getLoginLink,
|
getLoginLink: auth.settingsStore.getLoginLink,
|
||||||
|
getBackupCodes: auth.tfaStore.getTfaNewBackupCodes,
|
||||||
}))(observer(withTranslation("Profile")(SectionBodyContent)))
|
}))(observer(withTranslation("Profile")(SectionBodyContent)))
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user