diff options
author | Kim Alvefur <zash@zash.se> | 2023-02-23 14:34:10 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-02-23 14:34:10 +0100 |
commit | 96acef217098a0c0e7acebd6b162647167d11e25 (patch) | |
tree | 579b171564dfd4e530d50da88d6625c457d417cf | |
parent | 4704e98af6a3e8d00daa2d2da6e3f6d01df2ed7a (diff) | |
download | prosody-96acef217098a0c0e7acebd6b162647167d11e25.tar.gz prosody-96acef217098a0c0e7acebd6b162647167d11e25.zip |
mod_auth_internal_hashed: Implement is_enabled() method
Uses 'disabled' property already introduced in aed38948791f
-rw-r--r-- | plugins/mod_auth_internal_hashed.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/mod_auth_internal_hashed.lua b/plugins/mod_auth_internal_hashed.lua index 56f7d5d6..d5fa8e12 100644 --- a/plugins/mod_auth_internal_hashed.lua +++ b/plugins/mod_auth_internal_hashed.lua @@ -98,6 +98,7 @@ function provider.get_account_info(username) return { created = account.created; password_updated = account.updated; + enabled = not account.disabled; }; end @@ -111,8 +112,9 @@ function provider.user_exists(username) end function provider.is_enabled(username) -- luacheck: ignore 212 - -- TODO look up somewhere and allow disabling - return true; + local info, err = provider.get_account_info(username); + if not info then return nil, err; end + return info.enabled; end function provider.enable(username) -- luacheck: ignore 212 @@ -170,7 +172,7 @@ function provider.get_sasl_handler() local iteration_count, salt = credentials.iteration_count, credentials.salt; stored_key = stored_key and from_hex(stored_key); server_key = server_key and from_hex(server_key); - return stored_key, server_key, iteration_count, salt, provider.is_enabled(username); + return stored_key, server_key, iteration_count, salt, not credentials.disabled; end }; return new_sasl(host, testpass_authentication_profile); |