core/usermanager.lua

changeset 2934
060bb8217fea
parent 2929
1e4e314bef33
child 2987
0acfae4da199
child 3064
596303990c7c
--- a/core/usermanager.lua	Tue Mar 23 20:55:28 2010 +0500
+++ b/core/usermanager.lua	Wed Mar 24 00:03:31 2010 +0500
@@ -55,6 +55,15 @@
 	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

mercurial