diff options
author | Matthew Wild <mwild1@gmail.com> | 2022-07-12 13:14:47 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2022-07-12 13:14:47 +0100 |
commit | 4db3d1572390ce5b615282cb1112358d9e3ba892 (patch) | |
tree | 37bb45722201e08eb3e8a4ff1c88d27fbdd372ac /core | |
parent | af339f0e66480da6825fd655a5bf35e2824cfc00 (diff) | |
download | prosody-4db3d1572390ce5b615282cb1112358d9e3ba892.tar.gz prosody-4db3d1572390ce5b615282cb1112358d9e3ba892.zip |
usermanager, mod_auth_*: Add get_account_info() returning creation/update time
This is useful for a number of things. For example, listing users that need to
rotate their passwords after some event. It also provides a safer way for code
to determine that a user password has changed without needing to set a handler
for the password change event (which is a more fragile approach).
Diffstat (limited to 'core')
-rw-r--r-- | core/usermanager.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua index 970140ef..23571fe7 100644 --- a/core/usermanager.lua +++ b/core/usermanager.lua @@ -116,6 +116,12 @@ local function set_password(username, password, host, resource) return ok, err; end +local function get_account_info(username, host) + local method = hosts[host].users.get_account_info; + if not method then return nil, "method-not-supported"; end + return method(username); +end + local function user_exists(username, host) if hosts[host].sessions[username] then return true; end return hosts[host].users.user_exists(username); @@ -211,6 +217,7 @@ return { test_password = test_password; get_password = get_password; set_password = set_password; + get_account_info = get_account_info; user_exists = user_exists; create_user = create_user; delete_user = delete_user; |