Skip to content

Commit

Permalink
Merge branch 'release-1.0.75'
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Aug 18, 2023
2 parents 65c3fba + 68b6a1f commit dc13241
Show file tree
Hide file tree
Showing 10 changed files with 824 additions and 830 deletions.
27 changes: 15 additions & 12 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,22 @@
});
</script>
<script type="text/javascript">
if (window.location.hostname === "www.foodoasis.net") {
if (
window.location.hostname === "la.foodoasis.net" ||
window.location.hostname === "foodoasis.la"
) {
(function (c, l, a, r, i, t, y) {
c[a] =
c[a] ||
function () {
(c[a].q = c[a].q || []).push(arguments);
};
t = l.createElement(r);
t.async = 1;
t.src = "https://www.clarity.ms/tag/" + i;
y = l.getElementsByTagName(r)[0];
y.parentNode.insertBefore(t, y);
})(window, document, "clarity", "script", "icb9dr54qj");
c[a] =
c[a] ||
function () {
(c[a].q = c[a].q || []).push(arguments);
};
t = l.createElement(r);
t.async = 1;
t.src = "https://www.clarity.ms/tag/" + i;
y = l.getElementsByTagName(r)[0];
y.parentNode.insertBefore(t, y);
})(window, document, "clarity", "script", "icb9dr54qj");
}
</script>
</head>
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/Account/ConfirmEmail.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import EmailOutlinedIcon from "@mui/icons-material/EmailOutlined";
import LoadingButton from "@mui/lab/LoadingButton";
import { Avatar, Container, TextField, Typography, Box } from "@mui/material";
import { Avatar, TextField, Typography, Box } from "@mui/material";
import { Formik } from "formik";
import { useEffect, useState } from "react";
import { Navigate, useParams } from "react-router-dom";
Expand All @@ -18,7 +18,6 @@ const validationSchema = Yup.object().shape({
});

const ConfirmEmail = (props) => {
const { classes } = props;
const [confirmResult, setConfirmResult] = useState(false);
const { token } = useParams();
const { setToast } = useToasterContext();
Expand Down Expand Up @@ -148,7 +147,7 @@ const ConfirmEmail = (props) => {
{(props) => renderView(props)}
</Formik>
</Box>
</PageWrapper>
</PageWrapper>
);
};

Expand Down
262 changes: 127 additions & 135 deletions client/src/components/Account/ForgotPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ import { Formik } from "formik";
import * as Yup from "yup";
import * as accountService from "../../services/account-service";
import { Button } from "@mui/material";
import {
Avatar,
Container,
Link,
Grid,
TextField,
Typography,
Box
} from "@mui/material";
import { Avatar, Link, Grid, TextField, Typography, Box } from "@mui/material";
import LockOutlinedIcon from "@mui/icons-material/LockOutlined";
import { useToasterContext } from "../../contexts/toasterContext";
import debounce from "lodash.debounce";
Expand All @@ -20,16 +12,13 @@ import { useNavigate, useParams } from "react-router-dom";
import { palette } from "theme/palette";
import { PageWrapper } from "./PageWrapper";



const validationSchema = Yup.object().shape({
email: Yup.string()
.email("Invalid email address format")
.required("Email is required"),
});

const ForgotPassword = (props) => {
const { classes } = props;
const { setToast } = useToasterContext();
const { email } = useParams();
const navigate = useNavigate();
Expand All @@ -49,147 +38,150 @@ const ForgotPassword = (props) => {

return (
<PageWrapper>
<Box
<Box
sx={{
marginTop: "8px",
display: "flex",
flexDirection: "column",
alignItems: "center",
}}
>
<Avatar
>
<Avatar
sx={{
margin: "8px",
backgroundColor: palette.secondary.main,
}}>
<LockOutlinedIcon />
</Avatar>
<Typography component="h1" variant="h5">
Forgot Password
</Typography>
<Formik
validateOnBlur={false}
initialValues={{
email: email || "",
}}
validationSchema={validationSchema}
onSubmit={async (values, formikBag) => {
try {
const response = await accountService.forgotPassword(
values.email
);
if (response.isSuccess) {
navigate(`/resetpasswordemailsent/${values.email || ""}`);
} else if (
response.code === "FORGOT_PASSWORD_ACCOUNT_NOT_FOUND"
) {
const msg =
"Account not found. If you want to create a new account with this email, please register.";
console.error(msg);
setToast({
message: msg,
});
formikBag.setSubmitting(false);
} else if (response.code === "FORGOT_PASSWORD_EMAIL_FAILED") {
const msg =
"A problem occurred with sending an email to this address.";
console.error(msg);
setToast({
message: msg,
});
formikBag.setSubmitting(false);
} else {
console.error(response.message);
setToast({
message: response.message,
});
formikBag.setSubmitting(false);
}
} catch (err) {
}}
>
<LockOutlinedIcon />
</Avatar>
<Typography component="h1" variant="h5">
Forgot Password
</Typography>
<Formik
validateOnBlur={false}
initialValues={{
email: email || "",
}}
validationSchema={validationSchema}
onSubmit={async (values, formikBag) => {
try {
const response = await accountService.forgotPassword(
values.email
);
if (response.isSuccess) {
navigate(`/resetpasswordemailsent/${values.email || ""}`);
} else if (
response.code === "FORGOT_PASSWORD_ACCOUNT_NOT_FOUND"
) {
const msg =
"Account not found. If you want to create a new account with this email, please register.";
console.error(msg);
setToast({
message: msg,
});
formikBag.setSubmitting(false);
} else if (response.code === "FORGOT_PASSWORD_EMAIL_FAILED") {
const msg =
"A problem occurred with sending an email to this address.";
console.error(msg);
setToast({
message: msg,
});
formikBag.setSubmitting(false);
} else {
console.error(response.message);
setToast({
message: `Server error. ${err.message}`,
message: response.message,
});
console.error(err);
formikBag.setSubmitting(false);
}
}}
>
{({
values,
errors,
touched,
handleChange,
handleBlur,
handleSubmit,
isSubmitting,
setFieldError,
isValid,
}) => {
const handleEmailChange = (e) => {
handleChange(e);
debouncedEmailValidation(e.target.value, setFieldError);
};
return (
<form
noValidate
onSubmit={(evt) => {
evt.preventDefault();
handleSubmit(evt);
}}
>
<Grid
sx={{
} catch (err) {
setToast({
message: `Server error. ${err.message}`,
});
console.error(err);
formikBag.setSubmitting(false);
}
}}
>
{({
values,
errors,
touched,
handleChange,
handleBlur,
handleSubmit,
isSubmitting,
setFieldError,
isValid,
}) => {
const handleEmailChange = (e) => {
handleChange(e);
debouncedEmailValidation(e.target.value, setFieldError);
};
return (
<form
noValidate
onSubmit={(evt) => {
evt.preventDefault();
handleSubmit(evt);
}}
>
<Grid
sx={{
width: "100%", // Fix IE 11 issue.
marginTop: "8px"
marginTop: "8px",
}}
container spacing={2}>
<Grid item xs={12}>
<Label id="email" label="Email" />
<TextField
type="email"
id="email"
placeholder="Email"
name="email"
variant="outlined"
//margin="normal"
fullWidth
autoComplete="email"
autoFocus
value={values.email}
onChange={handleEmailChange}
onBlur={handleBlur}
helperText={touched.email ? errors.email : ""}
error={touched.email && Boolean(errors.email)}
/>
</Grid>
container
spacing={2}
>
<Grid item xs={12}>
<Label id="email" label="Email" />
<TextField
type="email"
id="email"
placeholder="Email"
name="email"
variant="outlined"
//margin="normal"
fullWidth
autoComplete="email"
autoFocus
value={values.email}
onChange={handleEmailChange}
onBlur={handleBlur}
helperText={touched.email ? errors.email : ""}
error={touched.email && Boolean(errors.email)}
/>
</Grid>

<Grid item xs={12}>
<Button
variant="contained"
type="submit"
fullWidth
disabled={isSubmitting || !isValid}
<Grid item xs={12}>
<Button
variant="contained"
type="submit"
fullWidth
disabled={isSubmitting || !isValid}
>
Send Password Reset Link
</Button>
</Grid>
<Grid item xs={12}>
<Typography align="center">
<Link
href={`/login/${values.email || ""}`}
variant="body2"
>
Send Password Reset Link
</Button>
</Grid>
<Grid item xs={12}>
<Typography align="center">
<Link
href={`/login/${values.email || ""}`}
variant="body2"
>
Return to Login
</Link>
</Typography>
</Grid>
Return to Login
</Link>
</Typography>
</Grid>
</form>
);
}}
</Formik>
</Box>
</PageWrapper>
</Grid>
</form>
);
}}
</Formik>
</Box>
</PageWrapper>
);
};

Expand Down
Loading

0 comments on commit dc13241

Please sign in to comment.