blob: e38acc87d0527d2cb72db891cec0c6df1989bcde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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;
|