// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import AdminSettings from './admin_settings.jsx'; import SettingsGroup from './settings_group.jsx'; import BooleanSetting from './boolean_setting.jsx'; import React from 'react'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; export default class MfaSettings extends AdminSettings { constructor(props) { super(props); this.getConfigFromState = this.getConfigFromState.bind(this); this.renderSettings = this.renderSettings.bind(this); this.state = Object.assign(this.state, { enableMultifactorAuthentication: props.config.ServiceSettings.EnableMultifactorAuthentication, enforceMultifactorAuthentication: props.config.ServiceSettings.EnforceMultifactorAuthentication }); } getConfigFromState(config) { config.ServiceSettings.EnableMultifactorAuthentication = this.state.enableMultifactorAuthentication; config.ServiceSettings.EnforceMultifactorAuthentication = this.state.enableMultifactorAuthentication && this.state.enforceMultifactorAuthentication; return config; } getStateFromConfig(config) { return { enableMultifactorAuthentication: config.ServiceSettings.EnableMultifactorAuthentication, enforceMultifactorAuthentication: config.ServiceSettings.EnableMultifactorAuthentication && config.ServiceSettings.EnforceMultifactorAuthentication }; } renderTitle() { return ( ); } renderSettings() { return (
} helpText={ } value={this.state.enableMultifactorAuthentication} onChange={this.handleChange} /> } helpText={ } disabled={!this.state.enableMultifactorAuthentication} value={this.state.enforceMultifactorAuthentication} onChange={this.handleChange} />
); } }