diff --git a/Client/src/Pages/Auth/Login.jsx b/Client/src/Pages/Auth/Login.jsx
index dffc87ab9..b6039eb16 100644
--- a/Client/src/Pages/Auth/Login.jsx
+++ b/Client/src/Pages/Auth/Login.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
-import { Box, Divider, FormControl, Stack, Typography } from "@mui/material";
+import { Box, Stack, Typography } from "@mui/material";
import { useTheme } from "@emotion/react";
import { credentials } from "../../Validation/validation";
import { login } from "../../Features/Auth/authSlice";
@@ -16,6 +16,148 @@ import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
import "./index.css";
+const LandingPage = ({ onContinue }) => {
+ const theme = useTheme();
+
+ return (
+ <>
+
+
+ Log In
+ We are pleased to see you again!
+
+
+ }
+ onClick={onContinue}
+ sx={{
+ width: "100%",
+ "& svg": {
+ mr: theme.gap.small,
+ },
+ }}
+ />
+
+
+
+ By continuing, you agree to our{" "}
+ Terms of Service and{" "}
+ Privacy Policy.
+
+
+
+ >
+ );
+};
+
+const StepOne = ({ form, errors, onSubmit, onChange, onBack }) => {
+ const theme = useTheme();
+
+ return (
+ <>
+
+
+ Log In
+ Enter your email address
+
+
+
+
+
+ }
+ onClick={onBack}
+ sx={{
+ mb: theme.gap.medium,
+ px: theme.gap.ml,
+ "& svg.MuiSvgIcon-root": {
+ mr: theme.gap.xs,
+ },
+ }}
+ />
+
+
+
+ >
+ );
+};
+
+const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
+ const theme = useTheme();
+
+ return (
+ <>
+
+
+ Log In
+ Enter your password
+
+
+
+
+
+ }
+ onClick={onBack}
+ sx={{
+ mb: theme.gap.medium,
+ px: theme.gap.ml,
+ "& svg.MuiSvgIcon-root": {
+ mr: theme.gap.xs,
+ },
+ }}
+ />
+
+
+
+ >
+ );
+};
+
const Login = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
@@ -45,47 +187,6 @@ const Login = () => {
});
}, [navigate]);
- const handleSubmit = async (e) => {
- e.preventDefault();
-
- const { error } = credentials.validate(form, { abortEarly: false });
-
- if (error) {
- // validation errors
- const newErrors = {};
- error.details.forEach((err) => {
- newErrors[err.path[0]] = err.message;
- });
- setErrors(newErrors);
- createToast({
- body:
- error.details && error.details.length > 0
- ? error.details[0].message
- : "Error validating data.",
- });
- } else {
- const action = await dispatch(login(form));
- if (action.payload.success) {
- navigate("/monitors");
- createToast({
- body: "Welcome back! You're successfully logged in.",
- });
- } else {
- if (action.payload) {
- // dispatch errors
- createToast({
- body: action.payload.msg,
- });
- } else {
- // unknown errors
- createToast({
- body: "Unknown error.",
- });
- }
- }
- }
- };
-
const handleChange = (event) => {
const { value, id } = event.target;
const name = idMap[id];
@@ -107,114 +208,62 @@ const Login = () => {
});
};
- const [step, setStep] = useState(0);
- const LandingPage = () => {
- return (
- <>
-
-
- Log In
- We are pleased to see you again!
-
-
- }
- onClick={() => setStep(1)}
- sx={{
- width: "100%",
- "& svg": {
- mr: theme.gap.small,
- },
- }}
- />
- {/* or
-
-
-
- By continuing, you agree to our{" "}
- Terms of Service and{" "}
- Privacy Policy.
-
-
-
- >
- );
- };
-
- const StepOne = () => {
- const submit = (event) => {
- event.preventDefault();
+ const handleSubmit = async (event) => {
+ event.preventDefault();
+ if (step === 1) {
const { error } = credentials.validate(
{ email: form.email },
{ abortEarly: false }
);
if (error) {
setErrors((prev) => ({ ...prev, email: error.details[0].message }));
- createToast({ body: "Invalid email address." });
+ createToast({ body: error.details[0].message });
} else {
setStep(2);
}
- };
+ } else if (step === 2) {
+ const { error } = credentials.validate(form, { abortEarly: false });
- return (
- <>
-
-
- Log In
- Enter your email address
-
-
-
-
-
- }
- onClick={() => setStep(0)}
- sx={{
- mb: theme.gap.medium,
- px: theme.gap.ml,
- "& svg.MuiSvgIcon-root": {
- mr: theme.gap.xs,
- },
- }}
- />
-
-
-
- >
- );
+ if (error) {
+ // validation errors
+ const newErrors = {};
+ error.details.forEach((err) => {
+ newErrors[err.path[0]] = err.message;
+ });
+ setErrors(newErrors);
+ createToast({
+ body:
+ error.details && error.details.length > 0
+ ? error.details[0].message
+ : "Error validating data.",
+ });
+ } else {
+ const action = await dispatch(login(form));
+ if (action.payload.success) {
+ navigate("/monitors");
+ createToast({
+ body: "Welcome back! You're successfully logged in.",
+ });
+ } else {
+ if (action.payload) {
+ // dispatch errors
+ createToast({
+ body: action.payload.msg,
+ });
+ } else {
+ // unknown errors
+ createToast({
+ body: "Unknown error.",
+ });
+ }
+ }
+ }
+ }
};
+ const [step, setStep] = useState(0);
+
return (
{
},
}}
>
- {step === 0 ? : step === 1 ? : ""}
+ {step === 0 ? (
+ setStep(1)} />
+ ) : step === 1 ? (
+ setStep(0)}
+ />
+ ) : (
+ step === 2 && (
+ setStep(1)}
+ />
+ )
+ )}
Don't have an account? -
@@ -267,87 +336,6 @@ const Login = () => {
Sign Up
- {/*
*/}
);
};
diff --git a/Client/src/Pages/Auth/index.css b/Client/src/Pages/Auth/index.css
index 6b688b33d..4d31fccc3 100644
--- a/Client/src/Pages/Auth/index.css
+++ b/Client/src/Pages/Auth/index.css
@@ -120,6 +120,10 @@
font-size: var(--env-var-font-size-large);
color: var(--env-var-color-2-light);
}
+.login-page .field h3.MuiTypography-root,
+.login-page .field input {
+ color: var(--env-var-color-5);
+}
.login-page .tos-p {
font-size: var(--env-var-font-size-medium-plus);
}
@@ -156,9 +160,16 @@
line-height: 1;
}
.login-page button:not(.MuiIconButton-root),
-.field .MuiInputBase-root:has(input) {
+.login-page .field .MuiInputBase-root:has(input) {
height: 40px;
}
+.login-page .field svg {
+ width: 24px;
+ height: 24px;
+}
+.login-page .field .MuiIconButton-root{
+ padding: 4px;
+}
.login-page > .MuiStack-root:nth-of-type(1) {
height: var(--env-var-nav-bar-height);
diff --git a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.css b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.css
index a799bf0af..1d1e36c88 100644
--- a/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.css
+++ b/Client/src/Pages/Maintenance/CreateMaintenanceWindow/index.css
@@ -16,6 +16,6 @@
width: 90px;
}
-.MuiInputAdornment-outlined .MuiIconButton-root svg {
+.maintenance-options .MuiInputAdornment-outlined .MuiIconButton-root svg {
width: 20px;
}