mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-24 23:04:00 +08:00
sending to inbox if user got banned
This commit is contained in:
parent
002d007f1f
commit
18f9785e04
1 changed files with 15 additions and 1 deletions
|
@ -34,6 +34,7 @@ import * as George from "../../tasks/george";
|
|||
import { getDailyLeaderboard } from "../../utils/daily-leaderboards";
|
||||
import AutoRoleList from "../../constants/auto-roles";
|
||||
import * as UserDAL from "../../dal/user";
|
||||
import { buildMonkeyMail } from "../../utils/monkey-mail";
|
||||
|
||||
try {
|
||||
if (anticheatImplemented() === false) throw new Error("undefined");
|
||||
|
@ -248,11 +249,24 @@ export async function addResult(
|
|||
//autoban
|
||||
const autoBanConfig = req.ctx.configuration.users.autoBan;
|
||||
if (autoBanConfig.enabled) {
|
||||
await recordAutoBanEvent(
|
||||
const didUserGetBanned = await recordAutoBanEvent(
|
||||
uid,
|
||||
autoBanConfig.maxCount,
|
||||
autoBanConfig.maxHours
|
||||
);
|
||||
if (didUserGetBanned) {
|
||||
const mail = buildMonkeyMail({
|
||||
getTemplate: () => ({
|
||||
subject: "Banned",
|
||||
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.maxMail
|
||||
);
|
||||
}
|
||||
}
|
||||
const status = MonkeyStatusCodes.BOT_DETECTED;
|
||||
throw new MonkeyError(status.code, "Possible bot detected");
|
||||
|
|
Loading…
Reference in a new issue