aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_xep0227.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-05-15 15:32:21 +0200
committerKim Alvefur <zash@zash.se>2015-05-15 15:32:21 +0200
commit0eb8dc6b654a64602579e8c6024db3eaa4bd4009 (patch)
tree3bf9186c490c05d67cd4a6aede75aa4c37fe36ed /plugins/mod_storage_xep0227.lua
parentb9384cee946de576e0ac35b21e7924dbe576cdd3 (diff)
downloadprosody-0eb8dc6b654a64602579e8c6024db3eaa4bd4009.tar.gz
prosody-0eb8dc6b654a64602579e8c6024db3eaa4bd4009.zip
mod_storage_xep0227: Store data from mod_auth_internal_hashed in a private namespace
Diffstat (limited to 'plugins/mod_storage_xep0227.lua')
-rw-r--r--plugins/mod_storage_xep0227.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua
index f1410d70..4510f5d1 100644
--- a/plugins/mod_storage_xep0227.lua
+++ b/plugins/mod_storage_xep0227.lua
@@ -66,19 +66,36 @@ end
local handlers = {};
+-- In order to support mod_auth_internal_hashed
+local extended = "http://prosody.im/protocol/extended-xep0227\1";
+
handlers.accounts = {
get = function(self, user)
local user = getUserElement(getXml(user, self.host));
if user and user.attr.password then
return { password = user.attr.password };
+ elseif user then
+ local data = {};
+ for k, v in pairs(user.attr) do
+ if k:sub(1, #extended) == extended then
+ data[k:sub(#extended+1)] = v;
+ end
+ end
+ return data;
end
end;
set = function(self, user, data)
- if data and data.password then
+ if data then
local xml = getXml(user, self.host);
if not xml then xml = createOuterXml(user, self.host); end
local usere = getUserElement(xml);
- usere.attr.password = data.password;
+ for k, v in pairs(data) do
+ if k == "password" then
+ usere.attr.password = v;
+ else
+ usere.attr[extended..k] = v;
+ end
+ end
return setXml(user, self.host, xml);
else
return setXml(user, self.host, nil);