mod_user_account_management: Apply username normalization later

Prevents traceback from nodeprep(nil)
This commit is contained in:
Kim Alvefur 2019-11-02 15:43:56 +01:00
parent b24814cbe4
commit 1783288951

View file

@ -53,9 +53,10 @@ local function handle_registration_stanza(event)
log("info", "User removed their account: %s@%s", username, host);
module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session });
else
local username = nodeprep(query:get_child_text("username"));
local username = query:get_child_text("username");
local password = query:get_child_text("password");
if username and password then
username = nodeprep(username);
if username == session.username then
if usermanager_set_password(username, password, session.host, session.resource) then
session.send(st.reply(stanza));