Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* @param {string} password - the password field value to validate
* @param {string} blankFieldErrorMessage - the error message to be displayed
* when the password value is empty
* @param {string} minimumLengthErrorMessage - the error message to be displayed
* when the password value is too short
*/
const validateChangePasswordFields = (password,blankFieldErrorMessage,minimumLengthErrorMessage) => {
const minimumLength = 22;
if (!password || password.trim() === '') {
return blankFieldErrorMessage;
} else if(password.length < minimumLength){
return minimumLengthErrorMessage;
}
}
export default reduxForm({
form: 'changePasswordForm', // a unique identifier for this form
fields: ['old_password', 'new_password', 'new_password_confirm'],
validate: function submit(values) {
let errors = {},
new_password = values.get('new_password'),
new_password_confirm = values.get('new_password_confirm');
const minimumLengthErrorMessage = I18n.t('changePassword.min_pwd_error');
//Old password validations
errors.old_password = validateChangePasswordFields(values.get('old_password'),
I18n.t('changePassword.enter_old_password'),minimumLengthErrorMessage)
//New password validations
errors.new_password = validateChangePasswordFields(new_password,
I18n.t('changePassword.enter_new_password'),minimumLengthErrorMessage)
//Confirm-New password validations
errors.new_password_confirm = validateChangePasswordFields(new_password_confirm,
I18n.t('changePassword.confirm_new_password'),minimumLengthErrorMessage)
<div>
<p>
{' '}
{I18n.t('signup.already_account')}{' '}
<a href="#">
{' '}
{I18n.t('signup.log_in')}{' '}
</a>{' '}
</p>
</div>
);
}
}
export default reduxForm({
form: 'registerAccountForm', // a unique identifier for this form
fields: ['accountName', 'password', 'password_retype', 'secure', 'understand'],
//Form field validations
validate: function submit(values) {
let errors = {};
//Account name field validations
let accountError = ChainValidation.is_account_name_error(values.get('accountName'));
if (accountError) {
errors.accountName = accountError;
} else {
if (!ChainValidation.is_cheap_name(values.get('accountName'))) {
errors.accountName = I18n.t('signup.premium_acc_text');
}
}
display: flex;
align-items: center;
`
// const styleClearButton = {
// marginRight: '10px'
// }
const styleButton = {
}
const WrapperButtons = styled.div`
`
@reduxForm()
export default class FiltersForm extends React.Component {
componentWillReceiveProps(nextProps) {
if (nextProps.location.pathname != this.props.location.pathname) {
this.props.destroy()
}
}
filterClear = () => {
this.props.destroy()
this.props.dispatch(push(this.props.location.pathname))
}
render() {
const {filters, handleSubmit} = this.props
return (
)
}
export default reduxForm(formConfig)(RequiredFields)
moreThanOne (wsLen, page, warcSeeds, onSubmit, formConfig) {
let FormPage = reduxForm(formConfig)(SeedListItem)
if (page < wsLen - 1 && page > 0) {
return ()
} else if (page === wsLen - 1) {
return ()
} else {
return ()
}
}
);
}
}
const formSelector = formValueSelector(FORM_NAME);
const mapStateToProps = state => ({
formValues: formSelector(state, ...REQUIRED_FIELDS),
});
const mapDispatchToProps = dispatch => ({
send: () => dispatch({ type: SEND_FEEDBACK }),
});
const withConnect = connect(mapStateToProps, mapDispatchToProps);
const withForm = reduxForm({ form: FORM_NAME, validate });
export default withForm(withConnect(Feedback));
hintText='WebSciDl'
name='screenName'
component={TextField}
fullWidth={true}
/>
)
}
}
export default reduxForm(formConfig)(UserBasic)
)}
{loading && }
);
}
}
RegisterForm.propTypes = {
handleSubmit: PropTypes.func,
registerError: PropTypes.string,
loading: PropTypes.bool,
};
const withForm = reduxForm({
form: 'registerPage',
validate,
});
export default compose(withForm)(RegisterForm);
};
const mapStateToProps = createStructuredSelector({
editnodetwo: makeSelectEditNode(),
values: getFormValues('EditNode'),
isActive: selectActive(),
headNode: selectHead(),
});
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
const withForm = reduxForm({ form: 'EditNode', validate });
const withConnect = connect(
mapStateToProps,
mapDispatchToProps,
);
const withReducer = injectReducer({ key: 'editNode', reducer });
const withSaga = injectSaga({ key: 'editNode', saga });
export default compose(
withReducer,
withSaga,
withForm,
withConnect,
)(EditNode);
)
NewCollectionForm.propTypes = {
onSubmit: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired
}
export default reduxForm(formConfig)(NewCollectionForm)