diff --git a/client/src/app-components/are-you-sure.js b/client/src/app-components/are-you-sure.js index 82b569c0..71c8cdd8 100644 --- a/client/src/app-components/are-you-sure.js +++ b/client/src/app-components/are-you-sure.js @@ -2,21 +2,27 @@ import React from 'react'; import i18n from 'lib-app/i18n'; import Button from 'core-components/button'; +import Input from 'core-components/input'; import ModalContainer from 'app-components/modal-container'; class AreYouSure extends React.Component { static propTypes = { description: React.PropTypes.node, - onYes: React.PropTypes.func + onYes: React.PropTypes.func, + type: React.PropTypes.string }; static contextTypes = { closeModal: React.PropTypes.func }; - - static openModal(description, onYes) { + + state = { + password: '' + }; + + static openModal(description, onYes, type) { ModalContainer.openModal( - + ); } @@ -33,6 +39,7 @@ class AreYouSure extends React.Component {
{this.props.description}
+ {this.props.type === 'secure' ? this.renderPassword() : null}
-
@@ -49,11 +56,31 @@ class AreYouSure extends React.Component { ); } - onYes() { - this.closeModal(); + renderPassword() { + return ( + + ); + } - if (this.props.onYes) { - this.props.onYes(); + onPasswordChange(event) { + this.setState({ + password: event.target.value + }); + } + + onInputKeyDown(event) { + if (event.keyCode == 13) { + this.onYes(); + } + } + + onYes() { + if (this.state.password){ + this.closeModal(); + + if (this.props.onYes) { + this.props.onYes(); + } } } diff --git a/client/src/app-components/are-you-sure.scss b/client/src/app-components/are-you-sure.scss index 04f4c40e..9bb1964a 100644 --- a/client/src/app-components/are-you-sure.scss +++ b/client/src/app-components/are-you-sure.scss @@ -27,4 +27,10 @@ display: inline-block; margin-right: 10px; } + + &__password { + margin: 0 auto; + margin-top: -30px; + margin-bottom: 20px; + } } \ No newline at end of file diff --git a/client/src/app/admin/panel/settings/admin-panel-advanced-settings.js b/client/src/app/admin/panel/settings/admin-panel-advanced-settings.js index 63b9e522..08867d35 100644 --- a/client/src/app/admin/panel/settings/admin-panel-advanced-settings.js +++ b/client/src/app/admin/panel/settings/admin-panel-advanced-settings.js @@ -4,6 +4,7 @@ import {connect} from 'react-redux'; import ConfigActions from 'actions/config-actions'; import i18n from 'lib-app/i18n'; import ToggleButton from 'app-components/toggle-button'; +import AreYouSure from 'app-components/are-you-sure'; import Button from 'core-components/button'; import FileUploader from 'core-components/file-uploader'; @@ -27,13 +28,13 @@ class AdminPanelAdvancedSettings extends React.Component {
{i18n('USER_SYSTEM_ENABLED')} - +
{i18n('REGISTRATION')} - +
@@ -66,6 +67,10 @@ class AdminPanelAdvancedSettings extends React.Component { ); } + onToggleButtonChange() { + AreYouSure.openModal(
{i18n('PLEASE_CONFIRM_PASSWORD')}
, (a) => a, 'secure'); + } + } diff --git a/client/src/data/languages/en.js b/client/src/data/languages/en.js index 53f6018a..0c934834 100644 --- a/client/src/data/languages/en.js +++ b/client/src/data/languages/en.js @@ -158,6 +158,7 @@ export default { 'INCLUDE_DATABASE_VIA_SQL': 'Include database via SQL file', 'BACKUP_DATABASE': 'Backup database', 'DELETE_ALL_USERS': 'Delete all users', + 'PLEASE_CONFIRM_PASSWORD': 'Please confirm your password to make these changes', //ACTIVITIES 'ACTIVITY_COMMENT': 'commented ticket',