plugins/mod_auth_internal_hashed.lua
changeset 12650 3f38f4735c7a
parent 12359 a0ff5c438e9d
child 12673 aed38948791f
--- a/plugins/mod_auth_internal_hashed.lua	Wed Jun 15 23:04:17 2022 +0200
+++ b/plugins/mod_auth_internal_hashed.lua	Tue Jul 12 13:14:47 2022 +0100
@@ -86,11 +86,21 @@
 		account.server_key = server_key_hex
 
 		account.password = nil;
+		account.updated = os.time();
 		return accounts:set(username, account);
 	end
 	return nil, "Account not available.";
 end
 
+function provider.get_account_info(username)
+	local account = accounts:get(username);
+	if not account then return nil, "Account not available"; end
+	return {
+		created = account.created;
+		password_updated = account.updated;
+	};
+end
+
 function provider.user_exists(username)
 	local account = accounts:get(username);
 	if not account then
@@ -115,9 +125,11 @@
 	end
 	local stored_key_hex = to_hex(stored_key);
 	local server_key_hex = to_hex(server_key);
+	local now = os.time();
 	return accounts:set(username, {
 		stored_key = stored_key_hex, server_key = server_key_hex,
-		salt = salt, iteration_count = default_iteration_count
+		salt = salt, iteration_count = default_iteration_count,
+		created = now, updated = now;
 	});
 end