Skip to content
Snippets Groups Projects
Commit 658d185e authored by Tania Fecheta's avatar Tania Fecheta
Browse files

refactor(passwordConfirmation): add desctructurinf and remove console logs

parent 17c7110d
No related branches found
No related tags found
3 merge requests!196S25 - EiC submit revision,!189S25,!183Hin 961 strong password
import React, { Fragment } from 'react'
import { required } from 'xpub-validators'
import { connect } from 'react-redux'
import { getFormValues, getFormSyncErrors } from 'redux-form'
import { getFormValues } from 'redux-form'
import { ValidatedField, TextField } from '@pubsweet/ui'
import { th } from '@pubsweet/ui-toolkit'
import { Row, Item, Label, IconButton } from 'pubsweet-component-faraday-ui'
......@@ -22,13 +22,10 @@ const PasswordConfirmation = ({
formName,
formLabel,
minLength,
formErrors = {},
atLeastOneDigit,
submitting = false,
atLeastOneUppercase,
submitFailed = false,
atLeastOneLowerrcase,
formSubmitErrors = {},
atLeastOnePunctuation,
}) => (
<Fragment>
......@@ -38,7 +35,6 @@ const PasswordConfirmation = ({
<ValidatedField
component={PasswordField}
name="password"
// name="newPassword"
validate={[required]}
/>
</Item>
......@@ -101,17 +97,14 @@ const PasswordConfirmation = ({
export default compose(
connect((state, props) => ({
formValues: getFormValues(props.formName)(state),
formErrors: getFormSyncErrors(props.formName)(state),
submitFailed: get(state, `form.${props.formName}.submitFailed`, false),
})),
withProps(({ formValues }) => ({
minLength: minLength(get(formValues, 'password', ''), 6),
atLeastOneUppercase: atLeastOneUppercase(get(formValues, 'password', '')),
atLeastOneLowerrcase: atLeastOneLowerrcase(get(formValues, 'password', '')),
atLeastOneDigit: atLeastOneDigit(get(formValues, 'password', '')),
atLeastOnePunctuation: atLeastOnePunctuation(
get(formValues, 'password', ''),
),
withProps(({ formValues: { password = '' } }) => ({
minLength: minLength(password, 6),
atLeastOneUppercase: atLeastOneUppercase(password),
atLeastOneLowerrcase: atLeastOneLowerrcase(password),
atLeastOneDigit: atLeastOneDigit(password),
atLeastOnePunctuation: atLeastOnePunctuation(password),
})),
)(PasswordConfirmation)
......
......@@ -147,7 +147,6 @@ export const passwordValidator = values => {
}
export const changePasswordValidator = values => {
// console.log(values, 'meri mai')
const {
currentPassword = '',
confirmNewPassword = '',
......
......@@ -12,6 +12,7 @@ module.exports = dir => {
/@pubsweet\/[^/]+\/src/,
/component-faraday-ui\/src/,
/component-modal\/src/,
/components-faraday\/src/,
]
return {
devtool: 'cheap-module-source-map',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment