Software /
code /
prosody
Comparison
core/usermanager.lua @ 12646:3f38f4735c7a
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).
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 12 Jul 2022 13:14:47 +0100 |
parent | 12642:9061f9621330 |
child | 12648:f299e570a0fe |
comparison
equal
deleted
inserted
replaced
12645:a741183eec97 | 12646:3f38f4735c7a |
---|---|
114 prosody.events.fire_event("user-password-changed", { username = username, host = host, resource = resource }); | 114 prosody.events.fire_event("user-password-changed", { username = username, host = host, resource = resource }); |
115 end | 115 end |
116 return ok, err; | 116 return ok, err; |
117 end | 117 end |
118 | 118 |
119 local function get_account_info(username, host) | |
120 local method = hosts[host].users.get_account_info; | |
121 if not method then return nil, "method-not-supported"; end | |
122 return method(username); | |
123 end | |
124 | |
119 local function user_exists(username, host) | 125 local function user_exists(username, host) |
120 if hosts[host].sessions[username] then return true; end | 126 if hosts[host].sessions[username] then return true; end |
121 return hosts[host].users.user_exists(username); | 127 return hosts[host].users.user_exists(username); |
122 end | 128 end |
123 | 129 |
209 new_null_provider = new_null_provider; | 215 new_null_provider = new_null_provider; |
210 initialize_host = initialize_host; | 216 initialize_host = initialize_host; |
211 test_password = test_password; | 217 test_password = test_password; |
212 get_password = get_password; | 218 get_password = get_password; |
213 set_password = set_password; | 219 set_password = set_password; |
220 get_account_info = get_account_info; | |
214 user_exists = user_exists; | 221 user_exists = user_exists; |
215 create_user = create_user; | 222 create_user = create_user; |
216 delete_user = delete_user; | 223 delete_user = delete_user; |
217 users = users; | 224 users = users; |
218 get_sasl_handler = get_sasl_handler; | 225 get_sasl_handler = get_sasl_handler; |