aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-09-29 17:34:47 +0200
committerKim Alvefur <zash@zash.se>2019-09-29 17:34:47 +0200
commitfc0e6e197d28d5a37b89a12bf9ae3119d0ae69d6 (patch)
tree55db5486a406495dc1542947cdd72b2ee4437342
parent90d58b619e2533d796e20235cfcd750a55152bf5 (diff)
downloadprosody-fc0e6e197d28d5a37b89a12bf9ae3119d0ae69d6.tar.gz
prosody-fc0e6e197d28d5a37b89a12bf9ae3119d0ae69d6.zip
mod_register_ibr: Distinguish between failure to create account or save extra data
-rw-r--r--plugins/mod_register_ibr.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins/mod_register_ibr.lua b/plugins/mod_register_ibr.lua
index 3f6da004..2f220658 100644
--- a/plugins/mod_register_ibr.lua
+++ b/plugins/mod_register_ibr.lua
@@ -179,14 +179,13 @@ module:hook("stanza/iq/jabber:iq:register:query", function(event)
return true;
end
- -- TODO unable to write file, file may be locked, etc, what's the correct error?
- local error_reply = st.error_reply(stanza, "wait", "internal-server-error", "Failed to write data to disk.");
- if usermanager_create_user(username, password, host) then
+ local created, err = usermanager_create_user(username, password, host);
+ if created then
data.registered = os.time();
if not account_details:set(username, data) then
log("debug", "Could not store extra details");
usermanager_delete_user(username, host);
- session.send(error_reply);
+ session.send(st.error_reply(stanza, "wait", "internal-server-error", "Failed to write data to disk."));
return true;
end
session.send(st.reply(stanza)); -- user created!
@@ -195,8 +194,8 @@ module:hook("stanza/iq/jabber:iq:register:query", function(event)
username = username, host = host, source = "mod_register",
session = session });
else
- log("debug", "Could not create user");
- session.send(error_reply);
+ log("debug", "Could not create user", err);
+ session.send(st.error_reply(stanza, "cancel", "feature-not-implemented", err));
end
return true;
end);