comparison mod_client_management/mod_client_management.lua @ 5369:1a58a11407ac

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
author Kim Alvefur <zash@zash.se>
date Tue, 25 Apr 2023 22:06:08 +0200
parents 5c1c70e52635
children d9d52ad8c1ae
comparison
equal deleted inserted replaced
5368:165ccec95585 5369:1a58a11407ac
204 end 204 end
205 end 205 end
206 206
207 -- Client has access if any password-based SASL mechanisms have been used since last password change 207 -- Client has access if any password-based SASL mechanisms have been used since last password change
208 for mech, mech_last_used in pairs(client.mechanisms) do 208 for mech, mech_last_used in pairs(client.mechanisms) do
209 if is_password_mechanism(mech) and mech_last_used >= last_password_change then 209 if is_password_mechanism(mech) and (not last_password_change or mech_last_used >= last_password_change) then
210 status.password = mech_last_used; 210 status.password = mech_last_used;
211 end 211 end
212 end 212 end
213 213
214 if prosody.full_sessions[client.full_jid] then 214 if prosody.full_sessions[client.full_jid] then