Mercurial > prosody-hg
comparison plugins/mod_user_account_management.lua @ 13387:e5ddae99faa8
mod_user_account_management: Clear pending deletion if account re-enabled
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 07 Dec 2023 12:08:01 +0000 |
| parents | ffbd058bb232 |
| children |
comparison
equal
deleted
inserted
replaced
| 13386:33e5edbd6a4a | 13387:e5ddae99faa8 |
|---|---|
| 168 if not enable_ok then | 168 if not enable_ok then |
| 169 return nil, "Removed account from deletion queue, but couldn't enable it: "..enable_err; | 169 return nil, "Removed account from deletion queue, but couldn't enable it: "..enable_err; |
| 170 end | 170 end |
| 171 return true, "Account restored"; | 171 return true, "Account restored"; |
| 172 end | 172 end |
| 173 | |
| 174 -- Automatically clear pending deletion if an account is re-enabled | |
| 175 module:context("*"):hook("user-enabled", function (event) | |
| 176 if event.host ~= module.host then return; end | |
| 177 deleted_accounts:set(event.username, nil); | |
| 178 end); | |
| 173 | 179 |
| 174 local cleanup_time = module:measure("cleanup", "times"); | 180 local cleanup_time = module:measure("cleanup", "times"); |
| 175 | 181 |
| 176 function cleanup_soft_deleted_accounts() | 182 function cleanup_soft_deleted_accounts() |
| 177 local cleanup_done = cleanup_time(); | 183 local cleanup_done = cleanup_time(); |
