setting cached user banned property,

not checking again if user is already banned
This commit is contained in:
Miodec 2023-05-17 13:33:21 +02:00
parent 445f61c8a8
commit 014e20cf82

View file

@ -276,7 +276,8 @@ export async function addResult(
result.wpm > 130 &&
result.testDuration < 122 &&
(user.verified === false || user.verified === undefined) &&
user.lbOptOut !== true
user.lbOptOut !== true &&
user.banned !== true //no need to check again if user is already banned
) {
if (!result.keySpacingStats || !result.keyDurationStats) {
const status = MonkeyStatusCodes.MISSING_KEY_DATA;
@ -301,6 +302,7 @@ export async function addResult(
body: "Your account has been automatically banned for triggering the anticheat system. If you believe this is a mistake, please contact support.",
});
UserDAL.addToInbox(uid, [mail], req.ctx.configuration.users.inbox);
user.banned = true;
}
}
const status = MonkeyStatusCodes.BOT_DETECTED;