 		expectedPerm: UserPowerLevels.admin
 		expectedArgs: ['id', 'auth', 'powerLevel']
 		onMessage: (msg, source) ->
-			(return fail "#{msg.id} exists") if containsUser source.id
+			(return fail "#{msg.id} exists") if containsUser msg.id
 			userRegistry.push new User msg.id, msg.powerLevel, Modules.sha msg.auth
+			onUserModification()
 			return succeed "#{msg.id} created"
 	}
 ]

loggedUsers = []
hostBlacklist = JSON.parse Modules.fs.readFileSync ResourceDir + "blacklist.json"
getFileJSON = (fname) -> JSON.parse Modules.fs.readFileSync "#{ResourceDir}#{fname}.json"
GlobalDebug = yes

# Declare object types using classes

# Login procedure
SIOServer.on 'connection', (socket) ->
	socket.on 'login', (data) ->
		if not data or not data.id? or not data.auth?
			socket.emit 'failure', 'expected data.id and data.auth, missing'
			return
		if connectionIsLoggedIn socket
