added error message if user is already linked

closes #2794
This commit is contained in:
Miodec 2022-03-31 19:47:18 +02:00
parent 6554b8b0ec
commit 5545b8e0a3

View file

@ -127,6 +127,12 @@ export async function linkDiscord(
const useRedisForBotTasks = req.ctx.configuration.useRedisForBotTasks.enabled;
const userInfo = await UsersDAO.getUser(uid);
if (userInfo.discordId) {
throw new MonkeyError(
409,
"This account is already linked to a Discord account"
);
}
if (userInfo.banned) {
throw new MonkeyError(403, "Banned accounts cannot link with Discord");
}
@ -145,7 +151,7 @@ export async function linkDiscord(
if (!discordIdAvailable) {
throw new MonkeyError(
409,
"This Discord account is already linked to a different account"
"This Discord account is linked to a different account"
);
}