diff options
author | Matthew Wild <mwild1@gmail.com> | 2022-08-22 13:53:35 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2022-08-22 13:53:35 +0100 |
commit | e4ed9a570ab61ef45ca0e63dfd6d230e26812749 (patch) | |
tree | 361af05ddf1d012f9ce849528d36cfa83a0715ba /plugins/mod_auth_internal_hashed.lua | |
parent | b79cb49bfba1d64dda54cf7243154624c53b5fb9 (diff) | |
parent | 227f6c033697210a54f671f5b9128cde8699fdcd (diff) | |
download | prosody-e4ed9a570ab61ef45ca0e63dfd6d230e26812749.tar.gz prosody-e4ed9a570ab61ef45ca0e63dfd6d230e26812749.zip |
Merge role-auth->trunk
Diffstat (limited to 'plugins/mod_auth_internal_hashed.lua')
-rw-r--r-- | plugins/mod_auth_internal_hashed.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/mod_auth_internal_hashed.lua b/plugins/mod_auth_internal_hashed.lua index cf851eef..ddff31e9 100644 --- a/plugins/mod_auth_internal_hashed.lua +++ b/plugins/mod_auth_internal_hashed.lua @@ -86,11 +86,21 @@ function provider.set_password(username, password) 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 @@ -105,8 +115,9 @@ function provider.users() end function provider.create_user(username, password) + local now = os.time(); if password == nil then - return accounts:set(username, {}); + return accounts:set(username, { created = now; updated = now; disabled = true }); end local salt = generate_uuid(); local valid, stored_key, server_key = get_auth_db(password, salt, default_iteration_count); @@ -117,7 +128,8 @@ function provider.create_user(username, password) local server_key_hex = to_hex(server_key); 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 |