From 9f181fb15e9249283d18cd8682e6bb940a9e52f7 Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Sun, 19 Nov 2023 22:28:02 -0500 Subject: [PATCH] bug fixed --- lib/api/controllers/users/postUser.ts | 5 +++++ lib/api/controllers/users/userId/updateUserById.ts | 5 +++++ styles/globals.css | 2 ++ 3 files changed, 12 insertions(+) diff --git a/lib/api/controllers/users/postUser.ts b/lib/api/controllers/users/postUser.ts index d9f24f9..22e52ec 100644 --- a/lib/api/controllers/users/postUser.ts +++ b/lib/api/controllers/users/postUser.ts @@ -30,6 +30,11 @@ export default async function postUser( ? !body.password || !body.name || !body.email : !body.username || !body.password || !body.name; + if (body.password.length < 8) + return res + .status(400) + .json({ response: "Password must be at least 8 characters." }); + if (checkHasEmptyFields) return res .status(400) diff --git a/lib/api/controllers/users/userId/updateUserById.ts b/lib/api/controllers/users/userId/updateUserById.ts index 3c4e03e..1d08203 100644 --- a/lib/api/controllers/users/userId/updateUserById.ts +++ b/lib/api/controllers/users/userId/updateUserById.ts @@ -23,6 +23,11 @@ export default async function updateUserById( response: "Username invalid.", status: 400, }; + if (data.newPassword && data.newPassword?.length < 8) + return { + response: "Password must be at least 8 characters.", + status: 400, + }; // Check email (if enabled) const checkEmail = diff --git a/styles/globals.css b/styles/globals.css index d1d26d6..bf9183c 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -234,6 +234,8 @@ body { } .reader-view img { margin: auto; + margin-top: 2rem; + margin-bottom: 2rem; border-radius: 10px; } .reader-view pre {