Comparison

plugins/mod_register_ibr.lua @ 10946:84441c19750e

mod_register_ibr: Add event for successful password reset This is in addition to the existing event for password changes. This one includes additional details about the actor, and only triggers when the change is due to the account owner (presumably) resetting. As example use case is to invalidate one-time password reset tokens.
author Matthew Wild <mwild1@gmail.com>
date Mon, 22 Jun 2020 11:35:24 +0100
parent 10939:99ae457c2459
child 12330:38b5b05407be
comparison
equal deleted inserted replaced
10945:2edb72ef312a 10946:84441c19750e
184 184
185 if usermanager_user_exists(username, host) then 185 if usermanager_user_exists(username, host) then
186 if user.allow_reset == username then 186 if user.allow_reset == username then
187 local ok, err = util_error.coerce(usermanager_set_password(username, password, host)); 187 local ok, err = util_error.coerce(usermanager_set_password(username, password, host));
188 if ok then 188 if ok then
189 module:fire_event("user-password-reset", user);
189 session.send(st.reply(stanza)); -- reset ok! 190 session.send(st.reply(stanza)); -- reset ok!
190 else 191 else
191 session.log("error", "Unable to reset password for %s@%s: %s", username, host, err); 192 session.log("error", "Unable to reset password for %s@%s: %s", username, host, err);
192 session.send(st.error_reply(stanza, err.type, err.condition, err.text)); 193 session.send(st.error_reply(stanza, err.type, err.condition, err.text));
193 end 194 end