- function provider.set_password(username, password)
- local account = datamanager.load(username, host, "accounts");
- if account then
- account.salt = account.salt or generate_uuid();
- account.iteration_count = account.iteration_count or iteration_count;
- local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, account.salt, account.iteration_count);
- local stored_key_hex = to_hex(stored_key);
- local server_key_hex = to_hex(server_key);
-
- account.stored_key = stored_key_hex
- account.server_key = server_key_hex
-
- account.password = nil;
- return datamanager.store(username, host, "accounts", account);
- end
- return nil, "Account not available.";
+ if credentials.iteration_count == nil or credentials.salt == nil or string.len(credentials.salt) == 0 then
+ return nil, "Auth failed. Stored salt and iteration count information is not complete.";