Mercurial > prosody-modules
diff mod_password_policy/mod_password_policy.lua @ 3350:cb26d04b391c
mod_password_policy: Return error as second result explaining failure reason
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 09 Oct 2018 14:02:42 +0100 |
parents | 1c14edca74a4 |
children | 662f2722f745 |
line wrap: on
line diff
--- a/mod_password_policy/mod_password_policy.lua Sun Oct 07 03:39:35 2018 +0200 +++ b/mod_password_policy/mod_password_policy.lua Tue Oct 09 14:02:42 2018 +0100 @@ -17,7 +17,10 @@ local st = require "util.stanza"; function check_password(password) - return #password >= options.length; + if #password < options.length then + return nil, ("Password is too short (minimum %d characters)"):format(options.length); + end + return true; end function handler(event)