|
@@ -18,7 +18,8 @@ import {
|
|
Typography,
|
|
Typography,
|
|
FormControlLabel,
|
|
FormControlLabel,
|
|
Radio,
|
|
Radio,
|
|
- Checkbox
|
|
|
|
|
|
+ Checkbox,
|
|
|
|
+ CircularProgress
|
|
} from "@mui/material";
|
|
} from "@mui/material";
|
|
import { useTheme } from "@mui/material/styles";
|
|
import { useTheme } from "@mui/material/styles";
|
|
|
|
|
|
@@ -104,10 +105,11 @@ const AuthRegister = () => {
|
|
return Yup.object().shape({
|
|
return Yup.object().shape({
|
|
email: Yup.string()
|
|
email: Yup.string()
|
|
.email(t("register.email_invalid").toString())
|
|
.email(t("register.email_invalid").toString())
|
|
- .max(255, t("register.email_max").toString())
|
|
|
|
|
|
+ .max(255, t("register.email_max", { count: 255 }).toString())
|
|
.required(t("register.email_required").toString()),
|
|
.required(t("register.email_required").toString()),
|
|
password: Yup.string()
|
|
password: Yup.string()
|
|
- .max(255, t("register.password_max").toString())
|
|
|
|
|
|
+ .min(8, t("register.password_min", { count: 8 }).toString())
|
|
|
|
+ .max(255, t("register.password_max", { count: 255 }).toString())
|
|
.required(t("register.password_required").toString()),
|
|
.required(t("register.password_required").toString()),
|
|
password_confirm: Yup.string()
|
|
password_confirm: Yup.string()
|
|
.oneOf([Yup.ref("password"), null], t("register.password_confirm_invalid").toString())
|
|
.oneOf([Yup.ref("password"), null], t("register.password_confirm_invalid").toString())
|
|
@@ -154,15 +156,14 @@ const AuthRegister = () => {
|
|
},
|
|
},
|
|
(error) => {
|
|
(error) => {
|
|
setStatus({ success: false });
|
|
setStatus({ success: false });
|
|
- setErrors({ submit: error.message });
|
|
|
|
|
|
+ setErrors(lo.isEmpty(error.errors) ? { submit: error.message } : error.errors);
|
|
}
|
|
}
|
|
);
|
|
);
|
|
} catch (err: any) {
|
|
} catch (err: any) {
|
|
console.error(err);
|
|
console.error(err);
|
|
if (scriptedRef.current) {
|
|
if (scriptedRef.current) {
|
|
setStatus({ success: false });
|
|
setStatus({ success: false });
|
|
- setErrors({ submit: err.message });
|
|
|
|
- setSubmitting(false);
|
|
|
|
|
|
+ setErrors(lo.isEmpty(err.errors) ? { submit: err.message } : err.errors);
|
|
}
|
|
}
|
|
} finally {
|
|
} finally {
|
|
setSubmitting(false);
|
|
setSubmitting(false);
|
|
@@ -409,7 +410,7 @@ const AuthRegister = () => {
|
|
variant="contained"
|
|
variant="contained"
|
|
color="primary"
|
|
color="primary"
|
|
>
|
|
>
|
|
- Create Account
|
|
|
|
|
|
+ {isSubmitting ? <CircularProgress size={24} color="inherit" /> : <Trans>{"register.submit"}</Trans>}
|
|
</Button>
|
|
</Button>
|
|
</AnimateButton>
|
|
</AnimateButton>
|
|
</Grid>
|
|
</Grid>
|