aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-03-24 00:03:31 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-03-24 00:03:31 +0500
commit84573ccf078fbe9993ebfa138448ca864ba4a1fd (patch)
tree1722a2bee1084e0d8937e0a1a5d4cde7b168b54e
parent2536fa75c312dd7175629dcc38b5619897f8f00b (diff)
downloadprosody-84573ccf078fbe9993ebfa138448ca864ba4a1fd.tar.gz
prosody-84573ccf078fbe9993ebfa138448ca864ba4a1fd.zip
usermanager: Added function set_password.
-rw-r--r--core/usermanager.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua
index efb2e750..8d7270c2 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -55,6 +55,15 @@ function get_password(username, host)
if is_cyrus(host) then return nil, "Passwords unavailable for Cyrus SASL."; end
return (datamanager.load(username, host, "accounts") or {}).password
end
+function set_password(username, host, password)
+ if is_cyrus(host) then return nil, "Passwords unavailable for Cyrus SASL."; end
+ local account = datamanager.load(username, host, "accounts");
+ if account then
+ account.password = password;
+ return datamanager.store(username, host, "accounts", account);
+ end
+ return nil, "Account not available.";
+end
function user_exists(username, host)
if is_cyrus(host) then return true; end