mod_auth_insecure: Store creation and update timestamps on account

This ensures that the store is not empty in case no password is
provided, so the underlying data storage won't consider the store empty.
This commit is contained in:
Kim Alvefur 2022-08-18 18:10:44 +02:00
parent 6f11c198b3
commit 742153c555

View file

@ -27,6 +27,7 @@ function provider.set_password(username, password)
return nil, "Password fails SASLprep."; return nil, "Password fails SASLprep.";
end end
if account then if account then
account.updated = os.time();
account.password = password; account.password = password;
return datamanager.store(username, host, "accounts", account); return datamanager.store(username, host, "accounts", account);
end end
@ -38,7 +39,8 @@ function provider.user_exists(username)
end end
function provider.create_user(username, password) function provider.create_user(username, password)
return datamanager.store(username, host, "accounts", {password = password}); local now = os.time();
return datamanager.store(username, host, "accounts", { created = now; updated = now; password = password });
end end
function provider.delete_user(username) function provider.delete_user(username)