Changeset

13506:1b81a7b7c9b8

mod_auth_internal_{hashed,plain}: Respect flag for disabled accounts in test_password() This API method is used e.g. in HTTP modules which also should respect disabled accounts.
author Kim Alvefur <zash@zash.se>
date Fri, 09 Aug 2024 20:23:46 +0200
parents 13504:2159a206684e
children 13507:4fb6a3eb9c29
files plugins/mod_auth_internal_hashed.lua plugins/mod_auth_internal_plain.lua
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_auth_internal_hashed.lua	Sat Aug 03 16:28:59 2024 +0200
+++ b/plugins/mod_auth_internal_hashed.lua	Fri Aug 09 20:23:46 2024 +0200
@@ -37,6 +37,9 @@
 function provider.test_password(username, password)
 	log("debug", "test password for user '%s'", username);
 	local credentials = accounts:get(username) or {};
+	if credentials.disabled then
+		return nil, "Account disabled.";
+	end
 	password = saslprep(password);
 	if not password then
 		return nil, "Password fails SASLprep.";
--- a/plugins/mod_auth_internal_plain.lua	Sat Aug 03 16:28:59 2024 +0200
+++ b/plugins/mod_auth_internal_plain.lua	Fri Aug 09 20:23:46 2024 +0200
@@ -22,6 +22,9 @@
 function provider.test_password(username, password)
 	log("debug", "test password for user '%s'", username);
 	local credentials = accounts:get(username) or {};
+	if credentials.disabled then
+		return nil, "Account disabled.";
+	end
 	password = saslprep(password);
 	if not password then
 		return nil, "Password fails SASLprep.";