From 30a10d35a8406f4af96fcc8200c4e2173856837d Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 12 Dec 2016 08:16:10 -0500 Subject: PLT-4767 Implement MFA Enforcement (#4662) * Create MFA setup page and remove MFA setup from account settings modal * Add enforce MFA to system console and force redirect * Lockdown mfa required API routes, add localization, other changes * Minor fixes * Fix typo * Fix some unit tests * Fix more unit tests * Minor fix * Updating UI for MFA screen (#4670) * Updating UI for MFA screen * Updating styles for MFA page * Add the ability to switch between email/sso with MFA enabled * Added mfa change email * Minor UI updates for MFA enforcement * Fix unit test * Fix client unit test * Allow switching email to ldap and back when MFA is enabled * Fix unit test * Revert config.json --- webapp/components/admin_console/mfa_settings.jsx | 99 ++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 webapp/components/admin_console/mfa_settings.jsx (limited to 'webapp/components/admin_console/mfa_settings.jsx') diff --git a/webapp/components/admin_console/mfa_settings.jsx b/webapp/components/admin_console/mfa_settings.jsx new file mode 100644 index 000000000..df6346fe4 --- /dev/null +++ b/webapp/components/admin_console/mfa_settings.jsx @@ -0,0 +1,99 @@ +// Copyright (c) 2016 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} + /> +
+ ); + } +} -- cgit v1.2.3-1-g7c22