Skip to content

Commit

Permalink
🚧 Do not support phrase.
Browse files Browse the repository at this point in the history
  • Loading branch information
tolerious committed Jul 8, 2024
1 parent 884a1bf commit e4e6225
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions middleware/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ const auth = function (req, res, next) {
return;
}
try {
console.log(req.headers);
let token = req.headers.authorization.replace(/bearer/i, "").trim();
console.log("token", token, typeof token);
// TODO: string 'english-burning' can be a global or config variable
if (!token || token === "null" || token === "undefined") {
console.log("token is null");
Expand Down
7 changes: 7 additions & 0 deletions routes/word.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ router.post("/", async function (req, res, next) {
res.json(generateResponse("", 400, "Please provide a word to save."));
return;
}
if (body.en.trim().split(" ").length > 1) {
res.json(
generateResponse("", 400, "Phrase is not allowed to save as a word.")
);
return;
}

const groupID = body.groupId;
const u = req.tUser;
Object.assign(body, { creator: u._id });
Expand Down

0 comments on commit e4e6225

Please sign in to comment.