diff --git a/src/main/authentication/Resources/modules/administration/authentication/components/tool.jsx b/src/main/authentication/Resources/modules/administration/authentication/components/tool.jsx index 3def155ed3e..d9bbf043e00 100644 --- a/src/main/authentication/Resources/modules/administration/authentication/components/tool.jsx +++ b/src/main/authentication/Resources/modules/administration/authentication/components/tool.jsx @@ -1,4 +1,5 @@ import React from 'react' +import {PropTypes as T} from 'prop-types' import get from 'lodash/get' import {trans} from '#/main/app/intl/translation' @@ -86,6 +87,15 @@ const AuthenticationTool = (props) => { type: 'boolean', label: trans('force_password_complexity', {}, 'security'), calculated: displayPasswordValidation, + onChange: (value) => { + if (!value) { + props.update('password.minLength', 0) + props.update('password.requireLowercase', false) + props.update('password.requireUppercase', false) + props.update('password.requireNumber', false) + props.update('password.requireSpecialChar', false) + } + }, linked: [ { name: 'password.minLength', @@ -122,6 +132,11 @@ const AuthenticationTool = (props) => { ) } +AuthenticationTool.propTypes = { + path: T.string.isRequired, + update: T.func.isRequired +} + export { AuthenticationTool } diff --git a/src/main/authentication/Resources/modules/administration/authentication/containers/tool.jsx b/src/main/authentication/Resources/modules/administration/authentication/containers/tool.jsx index a10b40c2e45..61dbdb21620 100644 --- a/src/main/authentication/Resources/modules/administration/authentication/containers/tool.jsx +++ b/src/main/authentication/Resources/modules/administration/authentication/containers/tool.jsx @@ -1,13 +1,20 @@ import {connect} from 'react-redux' +import {actions as formActions} from '#/main/app/content/form/store' import {selectors as toolSelectors} from '#/main/core/tool/store' import {AuthenticationTool as AuthenticationComponent} from '#/main/authentication/administration/authentication/components/tool' +import {selectors} from '#/main/authentication/administration/authentication/store' const AuthenticationTool = connect( (state) => ({ path: toolSelectors.path(state) + }), + (dispatch) => ({ + update(prop, value) { + dispatch(formActions.updateProp(selectors.FORM_NAME, prop, value)) + } }) )(AuthenticationComponent)