Diff

core/sessionmanager.lua @ 3236:4727b2b0e069

sessionmanager: Moved nodeprep to sessionmanager.make_authenticated.
author Waqas Hussain <waqas20@gmail.com>
date Fri, 11 Jun 2010 20:34:00 +0500
parent 3091:d6a059af2077
child 3239:5ea90ee96022
line wrap: on
line diff
--- a/core/sessionmanager.lua	Fri Jun 11 14:25:22 2010 +0100
+++ b/core/sessionmanager.lua	Fri Jun 11 20:34:00 2010 +0500
@@ -25,6 +25,7 @@
 local config_get = require "core.configmanager".get;
 local nameprep = require "util.encodings".stringprep.nameprep;
 local resourceprep = require "util.encodings".stringprep.resourceprep;
+local nodeprep = require "util.encodings".stringprep.nodeprep;
 
 local fire_event = require "core.eventmanager".fire_event;
 local add_task = require "util.timer".add_task;
@@ -109,6 +110,8 @@
 end
 
 function make_authenticated(session, username)
+	username = nodeprep(username);
+	if not username and #username > 0 then return nil, "Invalid username"; end
 	session.username = username;
 	if session.type == "c2s_unauthed" then
 		session.type = "c2s";