diff --git a/src/server.js b/src/server.js index 63e8fc3..0d12a46 100644 --- a/src/server.js +++ b/src/server.js @@ -23,10 +23,7 @@ server.create = function create(config = {}) { let userlist = {} let channellist = {} let server = net.createServer((socket) => { - const user = new User(socket) - if (!config.password) { - user.authenticated = true - } + const user = new User(socket, !config.password) socket.on('data', function (data) { data.toString("ascii").split("\r\n").forEach(function (commandline) { if (commandline == "") { diff --git a/src/user.js b/src/user.js index d2400c6..85030e0 100644 --- a/src/user.js +++ b/src/user.js @@ -1,6 +1,6 @@ -function User(socket) { +function User(socket, authenticatedDefault) { this.registered = false - this.authenticated = false + this.authenticated = authenticatedDefault this.nickname = "" this.connection = socket this.realname = ""