diff --git a/Client/src/Pages/Auth/Login.jsx b/Client/src/Pages/Auth/Login.jsx
index 78b1d7957..37591b310 100644
--- a/Client/src/Pages/Auth/Login.jsx
+++ b/Client/src/Pages/Auth/Login.jsx
@@ -94,7 +94,7 @@ const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
id="login-email-input"
label="Email"
isRequired={true}
- placeholder="john.doe@domain.com"
+ placeholder="jordan.ellis@domain.com"
autoComplete="email"
value={form.email}
onChange={onChange}
diff --git a/Client/src/Pages/Auth/Register/Register.jsx b/Client/src/Pages/Auth/Register/Register.jsx
index c048af9fd..761e1b3b2 100644
--- a/Client/src/Pages/Auth/Register/Register.jsx
+++ b/Client/src/Pages/Auth/Register/Register.jsx
@@ -11,13 +11,14 @@ import { useParams } from "react-router-dom";
import background from "../../../assets/Images/background_pattern_decorative.png";
import Logo from "../../../assets/icons/bwu-icon.svg?react";
import Mail from "../../../assets/icons/mail.svg?react";
+import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
import Check from "../../../Components/Check/Check";
import Button from "../../../Components/Button";
import Field from "../../../Components/Inputs/Field";
import axiosInstance from "../../../Utils/axiosConfig";
import "../index.css";
-const LandingPage = ({isAdmin}) => {
+const LandingPage = ({ isAdmin, onSignup }) => {
const theme = useTheme();
return (
@@ -34,6 +35,7 @@ const LandingPage = ({isAdmin}) => {
level="secondary"
label="Sign up with Email"
img={}
+ onClick={onSignup}
sx={{
width: "100%",
"& svg": {
@@ -54,6 +56,70 @@ const LandingPage = ({isAdmin}) => {
);
};
+const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
+ const theme = useTheme();
+ return (
+ <>
+
+
+ Sign Up
+ Enter your personal details
+
+
+
+
+
+ }
+ onClick={onBack}
+ sx={{
+ mb: theme.gap.medium,
+ px: theme.gap.ml,
+ "& svg.MuiSvgIcon-root": {
+ mr: theme.gap.xs,
+ },
+ }}
+ props={{ tabIndex: -1 }}
+ />
+
+
+
+ >
+ );
+};
+
const Register = ({ isAdmin }) => {
const dispatch = useDispatch();
const navigate = useNavigate();
@@ -77,6 +143,7 @@ const Register = ({ isAdmin }) => {
role: [],
});
const [errors, setErrors] = useState({});
+ const [step, setStep] = useState(0);
useEffect(() => {
const fetchInvite = async () => {
@@ -98,46 +165,64 @@ const Register = ({ isAdmin }) => {
const handleSubmit = async (e) => {
e.preventDefault();
- const registerForm = { ...form, role: isAdmin ? ["admin"] : form.role };
- const { error } = credentials.validate(registerForm, {
- abortEarly: false,
- context: { password: form.password },
- });
- if (error) {
- // validation errors
- const newErrors = {};
- error.details.forEach((err) => {
- newErrors[err.path[0]] = err.message;
+ if (step === 1) {
+ const { error } = credentials.validate(
+ { firstName: form.firstName, lastName: form.lastName },
+ { abortEarly: false }
+ );
+ if (error) {
+ const newErrors = {};
+ error.details.forEach((err) => {
+ newErrors[err.path[0]] = err.message;
+ });
+ setErrors(newErrors);
+ createToast({ body: error.details[0].message });
+ } else {
+ setStep(2);
+ }
+ } else if (step === 3) {
+ const registerForm = { ...form, role: isAdmin ? ["admin"] : form.role };
+ const { error } = credentials.validate(registerForm, {
+ abortEarly: false,
+ context: { password: form.password },
});
- setErrors(newErrors);
- createToast({
- body:
- error.details && error.details.length > 0
- ? error.details[0].message
- : "Error validating data.",
- });
- } else {
- delete registerForm.confirm;
- const action = await dispatch(register(registerForm));
- if (action.payload.success) {
- const token = action.payload.data;
- localStorage.setItem("token", token);
- navigate("/");
+
+ if (error) {
+ // validation errors
+ const newErrors = {};
+ error.details.forEach((err) => {
+ newErrors[err.path[0]] = err.message;
+ });
+ setErrors(newErrors);
createToast({
- body: "Welcome! Your account was created successfully.",
+ body:
+ error.details && error.details.length > 0
+ ? error.details[0].message
+ : "Error validating data.",
});
} else {
- if (action.payload) {
- // dispatch errors
+ delete registerForm.confirm;
+ const action = await dispatch(register(registerForm));
+ if (action.payload.success) {
+ const token = action.payload.data;
+ localStorage.setItem("token", token);
+ navigate("/");
createToast({
- body: action.payload.msg,
+ body: "Welcome! Your account was created successfully.",
});
} else {
- // unknown errors
- createToast({
- body: "Unknown error.",
- });
+ if (action.payload) {
+ // dispatch errors
+ createToast({
+ body: action.payload.msg,
+ });
+ } else {
+ // unknown errors
+ createToast({
+ body: "Unknown error.",
+ });
+ }
}
}
}
@@ -201,7 +286,19 @@ const Register = ({ isAdmin }) => {
},
}}
>
-
+ {step === 0 ? (
+ setStep(1)} />
+ ) : step === 1 ? (
+ setStep(0)}
+ />
+ ) : (
+ ""
+ )}
diff --git a/Client/src/Pages/Auth/index.css b/Client/src/Pages/Auth/index.css
index 2146bfecd..abce50887 100644
--- a/Client/src/Pages/Auth/index.css
+++ b/Client/src/Pages/Auth/index.css
@@ -85,10 +85,10 @@
font-weight: 600;
color: var(--env-var-color-3);
}
-.login-page button:not(.MuiIconButton-root),
-.login-page .field h3.MuiTypography-root,
-.login-page .field input,
-.login-page .field .input-error,
+.auth button:not(.MuiIconButton-root),
+.auth .field h3.MuiTypography-root,
+.auth .field input,
+.auth .field .input-error,
.auth p,
.auth span {
font-size: var(--env-var-font-size-medium-plus);
@@ -96,8 +96,8 @@
.auth p {
color: var(--env-var-color-2-light);
}
-.login-page .field h3.MuiTypography-root,
-.login-page .field input {
+.auth .field h3.MuiTypography-root,
+.auth .field input {
color: var(--env-var-color-5);
}