Skip to content
Snippets Groups Projects
Commit b5c32e55 authored by Anca Ursachi's avatar Anca Ursachi
Browse files

docs(PasswordConfirmation.md): Make the documentation for the passwordComfirmation component.

parent f086823e
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 React, { Fragment } from 'react'
import PropTypes from 'prop-types'
import { required } from 'xpub-validators' import { required } from 'xpub-validators'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { getFormValues } from 'redux-form' import { getFormValues } from 'redux-form'
...@@ -24,7 +25,7 @@ const PasswordConfirmation = ({ ...@@ -24,7 +25,7 @@ const PasswordConfirmation = ({
minLength, minLength,
atLeastOneDigit, atLeastOneDigit,
atLeastOneUppercase, atLeastOneUppercase,
submitFailed = false, submitFailed,
atLeastOneLowerrcase, atLeastOneLowerrcase,
atLeastOnePunctuation, atLeastOnePunctuation,
}) => ( }) => (
...@@ -93,6 +94,34 @@ const PasswordConfirmation = ({ ...@@ -93,6 +94,34 @@ const PasswordConfirmation = ({
</Row> </Row>
</Fragment> </Fragment>
) )
PasswordConfirmation.propTypes = {
/** Name of the redux form. */
formName: PropTypes.string,
/** Label name for password input */
formLabel: PropTypes.string,
/** If the password requirements are not fulfilled it will return true. */
submitFailed: PropTypes.bool,
/** If the password's length is greater or equal than the minimum value, it will return true. */
minLength: PropTypes.func,
/** If the password has at least one digit it will return true. */
atLeastOneDigit: PropTypes.func,
/** If the password has at least one uppercase it will return true. */
atLeastOneUppercase: PropTypes.func,
/** If the password has at least one lowercase it will return true. */
atLeastOneLowerrcase: PropTypes.func,
/** If the password has at least one punctuation it will return true. */
atLeastOnePunctuation: PropTypes.func,
}
PasswordConfirmation.defaultProps = {
formName: undefined,
formLabel: undefined,
submitFailed: false,
minLength: undefined,
atLeastOneDigit: undefined,
atLeastOneUppercase: undefined,
atLeastOneLowerrcase: undefined,
atLeastOnePunctuation: undefined,
}
export default compose( export default compose(
connect((state, props) => ({ connect((state, props) => ({
......
```js ```js
<div> const React = require('react')
<PasswordConfirmation/> const reduxForm = require('redux-form').reduxForm;
</div>
``` const PasswordField = () => (
\ No newline at end of file <PasswordConfirmation formLabel="Password" formName="signUpInvitation" />
)
const Form = reduxForm({
form: 'signUpInvitation',
destroyOnUnmount: false,
forceUnregisterOnUnmount: true,
})(PasswordField);
<Form />
```
...@@ -10,7 +10,8 @@ import { ...@@ -10,7 +10,8 @@ import {
PasswordConfirmation, PasswordConfirmation,
} from 'pubsweet-component-faraday-ui' } from 'pubsweet-component-faraday-ui'
import { passwordValidator, emailValidator } from '../utils' import { emailValidator } from '../utils'
import { passwordValidator } from '../../../../component-faraday-ui/src/Utils'
const EmailField = input => <TextField {...input} type="email" /> const EmailField = input => <TextField {...input} type="email" />
......
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