Web: Client: added tfa settings

This commit is contained in:
Viktor Fomin 2021-05-05 14:59:38 +03:00
parent daef594561
commit c8d73981a4
2 changed files with 23 additions and 4 deletions

View File

@ -59,8 +59,12 @@ const Confirm = ({ match }) => {
path={`${match.path}/PortalOwnerChange`} path={`${match.path}/PortalOwnerChange`}
component={ChangeOwnerForm} component={ChangeOwnerForm}
/> />
<Route exact path={`${match.path}/TfaAuth`} component={TfaAuthForm} /> <ConfirmRoute
<Route exact
path={`${match.path}/TfaAuth`}
component={TfaAuthForm}
/>
<ConfirmRoute
exact exact
path={`${match.path}/TfaActivation`} path={`${match.path}/TfaActivation`}
component={TfaActivationForm} component={TfaActivationForm}

View File

@ -31,9 +31,21 @@ class PureAccessPortal extends Component {
super(props); super(props);
const { t } = props; const { t } = props;
this.state = { type: "disabled" };
setDocumentTitle(t("ManagementCategorySecurity")); setDocumentTitle(t("ManagementCategorySecurity"));
} }
onSelectTfaType = (e) => this.setState({ type: e.target.value });
saveSettings = () => {
const { type } = this.state;
const { setTfaSettings } = this.props;
console.log("Save settings");
setTfaSettings(type);
};
render() { render() {
const { t } = this.props; const { t } = this.props;
@ -52,7 +64,7 @@ class PureAccessPortal extends Component {
options={[ options={[
{ {
label: t("Disabled"), label: t("Disabled"),
value: "disabled", value: "none",
}, },
{ {
label: t("BySms"), label: t("BySms"),
@ -64,13 +76,15 @@ class PureAccessPortal extends Component {
value: "app", value: "app",
}, },
]} ]}
selected="disabled" selected="none"
onClick={this.onSelectTfaType}
/> />
<Button <Button
label={t("SaveButton")} label={t("SaveButton")}
size="medium" size="medium"
primary={true} primary={true}
className="save-button" className="save-button"
onClick={this.saveSettings}
/> />
</MainContainer> </MainContainer>
); );
@ -79,4 +93,5 @@ class PureAccessPortal extends Component {
export default inject(({ auth }) => ({ export default inject(({ auth }) => ({
organizationName: auth.settingsStore.organizationName, organizationName: auth.settingsStore.organizationName,
setTfaSettings: auth.tfaStore.setTfaSettings,
}))(withTranslation("Settings")(withRouter(PureAccessPortal))); }))(withTranslation("Settings")(withRouter(PureAccessPortal)));