Skip to content

Commit

Permalink
[Authentication] fixes password parameters edition
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin authored and LaurentGruber committed Aug 1, 2023
1 parent 1507b28 commit f61650d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -122,6 +132,11 @@ const AuthenticationTool = (props) => {
)
}

AuthenticationTool.propTypes = {
path: T.string.isRequired,
update: T.func.isRequired
}

export {
AuthenticationTool
}
Original file line number Diff line number Diff line change
@@ -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)

Expand Down

0 comments on commit f61650d

Please sign in to comment.