Mercurial > prosody-hg
comparison plugins/mod_user_account_management.lua @ 10382:fcdc65bc6697
mod_user_account_management: Apply username normalization later
Prevents traceback from nodeprep(nil)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 02 Nov 2019 15:43:56 +0100 |
| parents | f591855f060d |
| children | 74b9e05af71e |
comparison
equal
deleted
inserted
replaced
| 10381:66fa45d24481 | 10382:fcdc65bc6697 |
|---|---|
| 51 end | 51 end |
| 52 | 52 |
| 53 log("info", "User removed their account: %s@%s", username, host); | 53 log("info", "User removed their account: %s@%s", username, host); |
| 54 module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session }); | 54 module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session }); |
| 55 else | 55 else |
| 56 local username = nodeprep(query:get_child_text("username")); | 56 local username = query:get_child_text("username"); |
| 57 local password = query:get_child_text("password"); | 57 local password = query:get_child_text("password"); |
| 58 if username and password then | 58 if username and password then |
| 59 username = nodeprep(username); | |
| 59 if username == session.username then | 60 if username == session.username then |
| 60 if usermanager_set_password(username, password, session.host, session.resource) then | 61 if usermanager_set_password(username, password, session.host, session.resource) then |
| 61 session.send(st.reply(stanza)); | 62 session.send(st.reply(stanza)); |
| 62 else | 63 else |
| 63 -- TODO unable to write file, file may be locked, etc, what's the correct error? | 64 -- TODO unable to write file, file may be locked, etc, what's the correct error? |
