- Fuse helps developers to build organized and well coded dashboards full of beautiful and
- rich modules. Join us and start building your application today.
-
-
-
-
-
-
-
-
-
-
- More than 17k people joined us, it's your turn
-
-
-
-
);
}
-export default SignInPage;
+export default withTranslation('signInPage')(SignInPage);
diff --git a/src/app/main/authPages/sign-up/SignUpPage.js b/src/app/main/authPages/sign-up/SignUpPage.js
index 9985f73..02fe2d6 100644
--- a/src/app/main/authPages/sign-up/SignUpPage.js
+++ b/src/app/main/authPages/sign-up/SignUpPage.js
@@ -1,109 +1,94 @@
import { yupResolver } from '@hookform/resolvers/yup';
-import { Controller, useForm } from 'react-hook-form';
+import _ from '@lodash';
import Button from '@mui/material/Button';
import Checkbox from '@mui/material/Checkbox';
import FormControl from '@mui/material/FormControl';
import FormControlLabel from '@mui/material/FormControlLabel';
+import FormHelperText from '@mui/material/FormHelperText';
+import Paper from '@mui/material/Paper';
import TextField from '@mui/material/TextField';
import Typography from '@mui/material/Typography';
+import { Controller, useForm } from 'react-hook-form';
+import { withTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
import * as yup from 'yup';
-import _ from '@lodash';
-import AvatarGroup from '@mui/material/AvatarGroup';
-import Avatar from '@mui/material/Avatar';
-import Box from '@mui/material/Box';
-import Paper from '@mui/material/Paper';
-import FormHelperText from '@mui/material/FormHelperText';
-import jwtService from '../../../auth/services/jwtService';
-
-/**
- * Form Validation Schema
- */
-const schema = yup.object().shape({
- displayName: yup.string().required('You must enter display name'),
- email: yup.string().email('You must enter a valid email').required('You must enter a email'),
- password: yup
- .string()
- .required('Please enter your password.')
- .min(8, 'Password is too short - should be 8 chars minimum.'),
- passwordConfirm: yup.string().oneOf([yup.ref('password'), null], 'Passwords must match'),
- acceptTermsConditions: yup.boolean().oneOf([true], 'The terms and conditions must be accepted.'),
-});
+import AdditionalSignWays from '../shared-components/AdditionalSignWays';
+import LeftSideCanvas from '../shared-components/LeftSideCanvas';
const defaultValues = {
- displayName: '',
+ name: '',
email: '',
password: '',
passwordConfirm: '',
acceptTermsConditions: false,
};
-function SignUpPage() {
+function SignUpPage({ t }) {
+ const schema = yup.object().shape({
+ name: yup.string().required(t('name_error')),
+ email: yup.string().email(t('email_error')).required(t('email_error')),
+ password: yup.string().required(t('password_error')).min(8, t('password_error')),
+ passwordConfirm: yup.string().oneOf([yup.ref('password'), null], t('password_confirm_error')),
+ acceptTermsConditions: yup.boolean().oneOf([true], t('accept_terms_error')),
+ });
+
const { control, formState, handleSubmit, reset } = useForm({
mode: 'onChange',
defaultValues,
resolver: yupResolver(schema),
});
- const { isValid, dirtyFields, errors, setError } = formState;
+ const { isValid, dirtyFields, errors } = formState;
- function onSubmit({ displayName, password, email }) {
- jwtService
- .createUser({
- displayName,
- password,
- email,
- })
- .then((user) => {
- // No need to do anything, registered user data will be set at app/auth/AuthContext
- })
- .catch((_errors) => {
- _errors.forEach((error) => {
- setError(error.type, {
- type: 'manual',
- message: error.message,
- });
- });
- });
+ function onSubmit() {
+ reset(defaultValues);
}
return (
-
- Fuse helps developers to build organized and well coded dashboards full of beautiful and
- rich modules. Join us and start building your application today.
-
-
-
-
-
-
-
-
-
-
- More than 17k people joined us, it's your turn
-