impr(server): also dont allow name changing for banned users

This commit is contained in:
Miodec 2024-04-28 19:33:55 +02:00
parent bfe39c62de
commit 5bee69a639

View file

@ -248,6 +248,10 @@ export async function updateName(
const user = await UserDAL.getUser(uid, "update name");
if (user.banned) {
throw new MonkeyError(403, "Banned users cannot change their name");
}
if (
!user?.needsToChangeName &&
Date.now() - (user.lastNameChange ?? 0) < MILLISECONDS_IN_DAY * 30