Private
Public Access
1
0

refacto: Deleting email mentions as there's no emailing system

This commit is contained in:
gauvainboiche
2026-03-31 16:54:11 +02:00
parent 42e68db00b
commit 7fa41ef7ac
6 changed files with 22 additions and 21 deletions

View File

@@ -16,8 +16,8 @@ function issueToken(user) {
// POST /api/auth/register
router.post("/register", async (req, res) => {
const { username, email, password, team } = req.body ?? {};
if (!username || !email || !password || !team) {
const { username, password, team } = req.body ?? {};
if (!username || !password || !team) {
return res.status(400).json({ error: "missing_fields" });
}
if (team !== "blue" && team !== "red") {
@@ -31,7 +31,7 @@ router.post("/register", async (req, res) => {
}
try {
const passwordHash = await bcrypt.hash(password, 12);
const user = await createUser(username.trim(), email.trim().toLowerCase(), passwordHash, team);
const user = await createUser(username.trim(), passwordHash, team);
const token = issueToken(user);
return res.status(201).json({
token,
@@ -39,7 +39,6 @@ router.post("/register", async (req, res) => {
});
} catch (e) {
if (e.code === "23505") {
if (e.constraint?.includes("email")) return res.status(409).json({ error: "email_taken" });
return res.status(409).json({ error: "username_taken" });
}
console.error(e);