Comparison

plugins/mod_admin_adhoc.lua @ 8192:4354f556c5db

core.usermanager, various modules: Disconnect other resources on password change (thanks waqas) (fixes #512)
author Kim Alvefur <zash@zash.se>
date Fri, 28 Jul 2017 13:15:29 +0200
parent 7045:49e2456bf2ce
child 8728:41c959c5c84b
comparison
equal deleted inserted replaced
8191:d43012448c1f 8192:4354f556c5db
95 end 95 end
96 local username, host, resource = jid.split(fields.accountjid); 96 local username, host, resource = jid.split(fields.accountjid);
97 if module_host ~= host then 97 if module_host ~= host then
98 return { status = "completed", error = { message = "Trying to change the password of a user on " .. host .. " but command was sent to " .. module_host}}; 98 return { status = "completed", error = { message = "Trying to change the password of a user on " .. host .. " but command was sent to " .. module_host}};
99 end 99 end
100 if usermanager_user_exists(username, host) and usermanager_set_password(username, fields.password, host) then 100 if usermanager_user_exists(username, host) and usermanager_set_password(username, fields.password, host, nil) then
101 return { status = "completed", info = "Password successfully changed" }; 101 return { status = "completed", info = "Password successfully changed" };
102 else 102 else
103 return { status = "completed", error = { message = "User does not exist" } }; 103 return { status = "completed", error = { message = "User does not exist" } };
104 end 104 end
105 end); 105 end);