File

core/usermanager.lua @ 151:096c7b9374fc

Presence fixes (again) - Presence to other resources sent correctly - Resource of the recipient ignored for all presence except available and unavailable - Set things up for presence subscriptions
author Waqas Hussain <waqas20@gmail.com>
date Fri, 24 Oct 2008 00:26:01 +0500
parent 60:44800be871f5
child 228:875842235836
line wrap: on
line source


require "util.datamanager"
local datamanager = datamanager;
local log = require "util.logger".init("usermanager");

module "usermanager"

function validate_credentials(host, username, password)
	log("debug", "User '%s' is being validated", username);
	local credentials = datamanager.load(username, host, "accounts") or {};
	if password == credentials.password then return true; end
	return false;
end

function user_exists(username, host)
	return datamanager.load(username, host, "accounts") ~= nil;
end

function create_user(username, password, host)
	return datamanager.store(username, host, "accounts", {password = password});
end

return _M;