Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/controllers/authController.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ export const signup = async (req, res) => {
try {
const { name, email, password } = req.body;

if (!name || name.trim().length < 2) {
if (!name || typeof name !== "string" || name.trim().length < 2) {
return res
.status(400)
.json({ message: "Name must be at least 2 characters long" });
}

const passwordRegex = /^(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]).{8,}$/;
if (!password || !passwordRegex.test(password)) {
if (!password || typeof password !== "string" || !passwordRegex.test(password)) {
return res.status(400).json({
message:
"Password must be at least 8 characters long, include an uppercase letter, a digit, and a special character",
Expand Down
Loading