Comparison

core/sessionmanager.lua @ 3239:5ea90ee96022 0.7.0

sessionmanager: Fixed a traceback on invalid usernames (typo in previous commit).
author Waqas Hussain <waqas20@gmail.com>
date Fri, 11 Jun 2010 21:30:24 +0500
parent 3236:4727b2b0e069
child 3240:9782a222e941
comparison
equal deleted inserted replaced
3238:362b94fa5a30 3239:5ea90ee96022
109 retire_session(session); 109 retire_session(session);
110 end 110 end
111 111
112 function make_authenticated(session, username) 112 function make_authenticated(session, username)
113 username = nodeprep(username); 113 username = nodeprep(username);
114 if not username and #username > 0 then return nil, "Invalid username"; end 114 if not username or #username == 0 then return nil, "Invalid username"; end
115 session.username = username; 115 session.username = username;
116 if session.type == "c2s_unauthed" then 116 if session.type == "c2s_unauthed" then
117 session.type = "c2s"; 117 session.type = "c2s";
118 end 118 end
119 session.log("info", "Authenticated as %s@%s", username or "(unknown)", session.host or "(unknown)"); 119 session.log("info", "Authenticated as %s@%s", username or "(unknown)", session.host or "(unknown)");