diff --git a/src/user.js b/src/user.js index f7fcca79..a8149712 100644 --- a/src/user.js +++ b/src/user.js @@ -381,6 +381,19 @@ User.prototype.guestLogin = function (name) { return; } + if (name.match(Config.get("reserved-names.usernames"))) { + LOGGER.warn( + 'Rejecting attempt by %s to use reserved username "%s"', + self.realip, + name + ); + self.socket.emit("login", { + success: false, + error: "That username is reserved." + }); + return; + } + // Prevent duplicate logins self.setFlag(Flags.U_LOGGING_IN); db.users.isUsernameTaken(name, function (err, taken) { diff --git a/src/web/auth.js b/src/web/auth.js index 90f9bbea..0fa4795c 100644 --- a/src/web/auth.js +++ b/src/web/auth.js @@ -190,6 +190,11 @@ function handleRegister(req, res) { } if (name.match(Config.get("reserved-names.usernames"))) { + LOGGER.warn( + 'Rejecting attempt by %s to register reserved username "%s"', + ip, + name + ); sendPug(res, "register", { registerError: "That username is reserved" });