IMPORTANT: due to a drive failure, as of 13-Mar-2021, the Mercurial repository had to be re-mirrored, which changed every commit SHA. The old SHAs and trees are backed up in the vault branches. Please migrate to the new branches as soon as you can.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
prosody/core/usermanager.lua

23 lines
647 B

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;