We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1a575e commit 4e9157cCopy full SHA for 4e9157c
user-service/controller/user-controller.js
@@ -16,9 +16,13 @@ export async function createUser(req, res) {
16
try {
17
const { username, email, password } = req.body;
18
if (username && email && password) {
19
- const existingUser = await _findUserByUsernameOrEmail(username, email);
+ let existingUser = await _findUserByUsername(username)
20
if (existingUser) {
21
- return res.status(409).json({ message: "username or email already exists" });
+ return res.status(409).json({ message: "Username already exists" });
22
+ }
23
+ existingUser = await _findUserByEmail(email);
24
+ if (existingUser) {
25
+ return res.status(409).json({ message: "Email already exists" });
26
}
27
28
const salt = bcrypt.genSaltSync(10);
0 commit comments