Skip to content

Commit 05c177d

Browse files
committed
Add required error message for sign up password field
1 parent 9e477eb commit 05c177d

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

frontend/src/components/PasswordTextField/index.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { Check, Clear, Visibility, VisibilityOff } from "@mui/icons-material";
1+
import {
2+
Check,
3+
Circle,
4+
Clear,
5+
Visibility,
6+
VisibilityOff,
7+
} from "@mui/icons-material";
28
import {
39
IconButton,
410
InputAdornment,
@@ -37,7 +43,16 @@ const TooltipMessage: React.FC<{
3743
paddingTop: theme.spacing(0.7),
3844
})}
3945
>
40-
{validator.validate(input) ? (
46+
{!input ? (
47+
<Circle
48+
sx={(theme) => ({
49+
fontSize: theme.spacing(0.8),
50+
marginTop: theme.spacing(0.8),
51+
marginLeft: theme.spacing(0.8),
52+
color: "white",
53+
})}
54+
/>
55+
) : validator.validate(input) ? (
4156
<Check
4257
sx={(theme) => ({
4358
fontSize: theme.spacing(2.5),

frontend/src/pages/SignUp/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import { ToastContainer } from "react-toastify";
1212
import "react-toastify/dist/ReactToastify.css";
1313
import { useForm } from "react-hook-form";
1414
import PasswordTextField from "../../components/PasswordTextField";
15-
import { USE_AUTH_ERROR_MESSAGE } from "../../utils/constants";
15+
import {
16+
PASSWORD_REQUIRED_ERROR_MESSAGE,
17+
USE_AUTH_ERROR_MESSAGE,
18+
} from "../../utils/constants";
1619

1720
const SignUp: React.FC = () => {
1821
const navigate = useNavigate();
@@ -138,6 +141,7 @@ const SignUp: React.FC = () => {
138141
input={watch("password", "")}
139142
{...register("password", {
140143
setValueAs: (value: string) => value.trim(),
144+
required: PASSWORD_REQUIRED_ERROR_MESSAGE,
141145
validate: { passwordValidator },
142146
})}
143147
error={!!errors.password}

0 commit comments

Comments
 (0)