changeset 145:890140ade4e5

mod_adhoc_cmd_admin: Use new set_password function if available
author Florian Zeitz <florob@babelmonkeys.de>
date Thu, 25 Mar 2010 00:09:10 +0100 (2010-03-24)
parents b4f9518d5a00
children 2620bc59cca3
files mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua	Fri Mar 12 03:15:49 2010 +0100
+++ b/mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua	Thu Mar 25 00:09:10 2010 +0100
@@ -12,8 +12,10 @@
 local t_concat = table.concat;
 
 local usermanager_user_exists = require "core.usermanager".user_exists;
+local usermanager_create_user = require "core.usermanager".create_user;
 local usermanager_get_password = require "core.usermanager".get_password;
-local usermanager_create_user = require "core.usermanager".create_user;
+local usermanager_set_password = require "core.usermanager".set_password or
+	function (username, host, password) return usermanager_create_user(username, password, host) end;
 local is_admin = require "core.usermanager".is_admin;
 
 local rm_load_roster = require "core.rostermanager".load_roster;
@@ -161,7 +163,7 @@
 		end
 		local fields = change_user_password_layout:data(data.form);
 		local username, host, resource = jid.split(fields.accountjid);
-		if usermanager_user_exists(username, host) and usermanager_create_user(username, fields.password, host) then
+		if usermanager_user_exists(username, host) and usermanager_set_password(username, host, fields.password) then
 			return { status = "completed", info = "Password successfully changed" };
 		else
 			return { status = "error", error = { type = "cancel", condition = "item-not-found", message = "User does not exist" } };