end
function provider.create_user(username, password)
+ if password == nil then
+ return datamanager.store(username, host, "accounts", {});
+ end
local salt = generate_uuid();
local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, salt, iteration_count);
local stored_key_hex = to_hex(stored_key);
log("debug", "NODEprep failed on username: %s", username);
return "", nil;
end
- return usermanager.test_password(prepped_username, password, realm), true;
+ return usermanager.test_password(prepped_username, realm, password), true;
end,
scram_sha_1 = function(username, realm)
- local credentials = datamanager.load(username, host, "accounts") or {};
+ local credentials = datamanager.load(username, host, "accounts");
+ if not credentials then return; end
if credentials.password then
usermanager.set_password(username, credentials.password, host);
- credentials = datamanager.load(username, host, "accounts") or {};
+ credentials = datamanager.load(username, host, "accounts");
+ if not credentials then return; end
end
-- convert hexpass to stored_key and server_key
credentials.hashpass = nil
datamanager.store(username, host, "accounts", credentials);
end
-
+
local stored_key, server_key, iteration_count, salt = credentials.stored_key, credentials.server_key, credentials.iteration_count, credentials.salt;
stored_key = stored_key and from_hex(stored_key);
server_key = server_key and from_hex(server_key);