# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1682453168 -7200
# Node ID 1a58a11407ac0fd0d99b204067269dcdaf3414f5
# Parent  165ccec95585f32551b2596a8c1697d25880f1d2
mod_client_management: Fix error when last password change is unknown (or never)

Fixes attempt to compare nil with number here, due to
last_password_change being nil

diff -r 165ccec95585 -r 1a58a11407ac mod_client_management/mod_client_management.lua
--- a/mod_client_management/mod_client_management.lua	Tue Apr 25 19:50:27 2023 +0200
+++ b/mod_client_management/mod_client_management.lua	Tue Apr 25 22:06:08 2023 +0200
@@ -206,7 +206,7 @@
 
 	-- Client has access if any password-based SASL mechanisms have been used since last password change
 	for mech, mech_last_used in pairs(client.mechanisms) do
-		if is_password_mechanism(mech) and mech_last_used >= last_password_change then
+		if is_password_mechanism(mech) and (not last_password_change or mech_last_used >= last_password_change) then
 			status.password = mech_last_used;
 		end
 	end