import PropTypes from 'prop-types'; import React, { Component } from 'react'; import FieldSet from 'Components/FieldSet'; import FormGroup from 'Components/Form/FormGroup'; import FormInputButton from 'Components/Form/FormInputButton'; import FormInputGroup from 'Components/Form/FormInputGroup'; import FormLabel from 'Components/Form/FormLabel'; import Icon from 'Components/Icon'; import ClipboardButton from 'Components/Link/ClipboardButton'; import ConfirmModal from 'Components/Modal/ConfirmModal'; import { icons, inputTypes, kinds } from 'Helpers/Props'; import translate from 'Utilities/String/translate'; const authenticationMethodOptions = [ { key: 'none', value: 'None' }, { key: 'basic', value: 'Basic (Browser Popup)' }, { key: 'forms', value: 'Forms (Login Page)' } ]; const certificateValidationOptions = [ { key: 'enabled', value: 'Enabled' }, { key: 'disabledForLocalAddresses', value: 'Disabled for Local Addresses' }, { key: 'disabled', value: 'Disabled' } ]; class SecuritySettings extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { isConfirmApiKeyResetModalOpen: false }; } // // Listeners onApikeyFocus = (event) => { event.target.select(); } onResetApiKeyPress = () => { this.setState({ isConfirmApiKeyResetModalOpen: true }); } onConfirmResetApiKey = () => { this.setState({ isConfirmApiKeyResetModalOpen: false }); this.props.onConfirmResetApiKey(); } onCloseResetApiKeyModal = () => { this.setState({ isConfirmApiKeyResetModalOpen: false }); } // // Render render() { const { settings, isResettingApiKey, onInputChange } = this.props; const { authenticationMethod, username, password, apiKey, certificateValidation } = settings; const authenticationEnabled = authenticationMethod && authenticationMethod.value !== 'none'; return (
{translate('Authentication')} { authenticationEnabled && {translate('Username')} } { authenticationEnabled && {translate('Password')} } {translate('APIKey')} , ]} onChange={onInputChange} onFocus={this.onApikeyFocus} {...apiKey} /> {translate('CertificateValidation')}
); } } SecuritySettings.propTypes = { settings: PropTypes.object.isRequired, isResettingApiKey: PropTypes.bool.isRequired, onInputChange: PropTypes.func.isRequired, onConfirmResetApiKey: PropTypes.func.isRequired }; export default SecuritySettings;