Added authentication step 1 / 2
This commit is contained in:
1 parent
72b813e849
commit
d68ef08f6d
3 files changed
+84
-15
No files matched your search
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="./public/bluewave_favicon.ico" />
|
<link rel="icon" href="./bluewave_favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>BlueWave Uptime</title>
|
<title>BlueWave Uptime</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import {
|
import { Box, Divider, FormControl, Stack, Typography } from "@mui/material";
|
||||||
Box,
|
|
||||||
Divider,
|
|
||||||
FormControlLabel,
|
|
||||||
Stack,
|
|
||||||
Typography,
|
|
||||||
} from "@mui/material";
|
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { credentials } from "../../Validation/validation";
|
import { credentials } from "../../Validation/validation";
|
||||||
import { login } from "../../Features/Auth/authSlice";
|
import { login } from "../../Features/Auth/authSlice";
|
||||||
@@ -18,6 +12,7 @@ import Field from "../../Components/Inputs/Field";
|
|||||||
import background from "../../assets/Images/background_pattern_decorative.png";
|
import background from "../../assets/Images/background_pattern_decorative.png";
|
||||||
import Logo from "../../assets/icons/bwu-icon.svg?react";
|
import Logo from "../../assets/icons/bwu-icon.svg?react";
|
||||||
import Mail from "../../assets/icons/mail.svg?react";
|
import Mail from "../../assets/icons/mail.svg?react";
|
||||||
|
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
||||||
|
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
@@ -154,6 +149,72 @@ const Login = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const StepOne = () => {
|
||||||
|
const submit = (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const { error } = credentials.validate(
|
||||||
|
{ email: form.email },
|
||||||
|
{ abortEarly: false }
|
||||||
|
);
|
||||||
|
if (error) {
|
||||||
|
setErrors((prev) => ({ ...prev, email: error.details[0].message }));
|
||||||
|
createToast({ body: "Invalid email address." });
|
||||||
|
} else {
|
||||||
|
setStep(2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack gap={theme.gap.large} textAlign="center">
|
||||||
|
<Box>
|
||||||
|
<Typography component="h1">Log In</Typography>
|
||||||
|
<Typography>Enter your email address</Typography>
|
||||||
|
</Box>
|
||||||
|
<Box textAlign="left">
|
||||||
|
<form onSubmit={submit}>
|
||||||
|
<Field
|
||||||
|
type="email"
|
||||||
|
id="login-email-input"
|
||||||
|
label="Email"
|
||||||
|
isRequired={true}
|
||||||
|
placeholder="john.doe@domain.com"
|
||||||
|
autoComplete="email"
|
||||||
|
value={form.email}
|
||||||
|
onChange={handleChange}
|
||||||
|
error={errors.email}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
</Box>
|
||||||
|
<Stack direction="row" justifyContent="space-between">
|
||||||
|
<Button
|
||||||
|
level="secondary"
|
||||||
|
label="Back"
|
||||||
|
animate="slideLeft"
|
||||||
|
img={<ArrowBackRoundedIcon />}
|
||||||
|
onClick={() => setStep(0)}
|
||||||
|
sx={{
|
||||||
|
mb: theme.gap.medium,
|
||||||
|
px: theme.gap.ml,
|
||||||
|
"& svg.MuiSvgIcon-root": {
|
||||||
|
mr: theme.gap.xs,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
level="primary"
|
||||||
|
label="Continue"
|
||||||
|
onClick={submit}
|
||||||
|
disabled={errors.email && true}
|
||||||
|
sx={{ width: "30%" }}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack className="login-page" overflow="hidden">
|
<Stack className="login-page" overflow="hidden">
|
||||||
<img
|
<img
|
||||||
@@ -171,7 +232,8 @@ const Login = () => {
|
|||||||
<Typography>BlueWave Uptime</Typography>
|
<Typography>BlueWave Uptime</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack
|
<Stack
|
||||||
width="fit-content"
|
width="100%"
|
||||||
|
maxWidth={600}
|
||||||
flex={1}
|
flex={1}
|
||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
p={theme.gap.xl}
|
p={theme.gap.xl}
|
||||||
@@ -186,12 +248,11 @@ const Login = () => {
|
|||||||
padding: {
|
padding: {
|
||||||
xs: theme.gap.large,
|
xs: theme.gap.large,
|
||||||
sm: theme.gap.xl,
|
sm: theme.gap.xl,
|
||||||
lg: theme.gap.xxl,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<LandingPage />
|
{step === 0 ? <LandingPage /> : step === 1 ? <StepOne /> : ""}
|
||||||
</Stack>
|
</Stack>
|
||||||
<Box textAlign="center" p={theme.gap.large}>
|
<Box textAlign="center" p={theme.gap.large}>
|
||||||
<Typography display="inline-block">Don't have an account? -</Typography>
|
<Typography display="inline-block">Don't have an account? -</Typography>
|
||||||
|
|||||||
@@ -107,6 +107,7 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
.login-page {
|
.login-page {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
@@ -115,7 +116,6 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--env-var-color-3);
|
color: var(--env-var-color-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-page p {
|
.login-page p {
|
||||||
font-size: var(--env-var-font-size-large);
|
font-size: var(--env-var-font-size-large);
|
||||||
color: var(--env-var-color-2-light);
|
color: var(--env-var-color-2-light);
|
||||||
@@ -145,16 +145,24 @@
|
|||||||
.login-page p + span:hover {
|
.login-page p + span:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
.login-page button:not(.MuiIconButton-root) {
|
.login-page button:not(.MuiIconButton-root),
|
||||||
|
.login-page .field h3.MuiTypography-root,
|
||||||
|
.login-page .field input,
|
||||||
|
.login-page .field .input-error {
|
||||||
font-size: var(--env-var-font-size-medium-plus);
|
font-size: var(--env-var-font-size-medium-plus);
|
||||||
height: 40px;
|
}
|
||||||
|
.login-page button:not(.MuiIconButton-root) {
|
||||||
border-radius: var(--env-var-radius-2);
|
border-radius: var(--env-var-radius-2);
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.login-page button:not(.MuiIconButton-root),
|
||||||
|
.field .MuiInputBase-root:has(input) {
|
||||||
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-page > .MuiStack-root:nth-of-type(1) {
|
.login-page > .MuiStack-root:nth-of-type(1) {
|
||||||
height: var(--env-var-nav-bar-height);
|
height: var(--env-var-nav-bar-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-page .background-pattern-svg {
|
.login-page .background-pattern-svg {
|
||||||
top: 14%;
|
top: 14%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
Reference in new issue
Block a user