diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-03-24 00:03:31 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-03-24 00:03:31 +0500 |
commit | 84573ccf078fbe9993ebfa138448ca864ba4a1fd (patch) | |
tree | 1722a2bee1084e0d8937e0a1a5d4cde7b168b54e /core/usermanager.lua | |
parent | 2536fa75c312dd7175629dcc38b5619897f8f00b (diff) | |
download | prosody-84573ccf078fbe9993ebfa138448ca864ba4a1fd.tar.gz prosody-84573ccf078fbe9993ebfa138448ca864ba4a1fd.zip |
usermanager: Added function set_password.
Diffstat (limited to 'core/usermanager.lua')
-rw-r--r-- | core/usermanager.lua | 9 |
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 |