aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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