%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.632e77b3fb93bc8da5b589b869bc0037/static/js/components/ForgotPassword/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.632e77b3fb93bc8da5b589b869bc0037/static/js/components/ForgotPassword/ResetPasswordForm.js |
import React from "react"; import { bool, func, object, string, } from "prop-types"; import { withTranslation } from "react-i18next"; import { Field, reduxForm } from "redux-form"; import { withStyles } from "@material-ui/core/styles"; import { Button, PasswordField, PasswordFieldset, RenderField, styles, Box, } from "common/components"; import { required, minPasswordLength, maxPasswordLength45 } from "utils/fieldValidations"; function CodeForm({ t, handleSubmit, resetPasswordToken, phone, token, fullToken, newPassword, isOpenedWithToken, pswValidationMsg, classes, }) { return ( <form name="resetPasswordForm" onSubmit={handleSubmit(() => resetPasswordToken( phone, token, newPassword, fullToken, isOpenedWithToken, ))} > <Box container spacing={2}> <Box item> <div className={classes.titleSmall}>{t("setNewPassword.title")}</div> <p className={classes.bodyLarge}>{t("setNewPassword.description")}</p> </Box> <Box> <PasswordFieldset> <Box> <PasswordField> <Field name="rpass" component={RenderField} placeholder={t("setNewPassword.placeholder")} validate={[required, minPasswordLength, maxPasswordLength45]} type="text" t={t} triggerOnBlur /> </PasswordField> </Box> </PasswordFieldset> </Box> <div> <p className="validation-error text-center help-block error"> {pswValidationMsg} </p> <Button primary type="submit" fullWidth > {t("setNewPassword.button")} </Button> </div> </Box> </form> ); } CodeForm.propTypes = { handleSubmit: func.isRequired, resetPasswordToken: func.isRequired, phone: string, token: string, fullToken: string, newPassword: string, isOpenedWithToken: bool, pswValidationMsg: string, t: func.isRequired, classes: object.isRequired, }; CodeForm.defaultProps = { phone: "", token: "", fullToken: "", newPassword: "", isOpenedWithToken: false, pswValidationMsg: "", }; export default withTranslation()( reduxForm({ form: "resetPasswordForm", touchOnBlur: false, })(withStyles(styles)(CodeForm)), );