# HG changeset patch # User Matthew Wild # Date 1539090162 -3600 # Node ID cb26d04b391ce084629760ddb597c4968618d558 # Parent 35dc7c38e362493995dab349d83fd431bcb47e63 mod_password_policy: Return error as second result explaining failure reason diff -r 35dc7c38e362 -r cb26d04b391c mod_password_policy/mod_password_policy.lua --- 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)