# HG changeset patch # User Kim Alvefur # Date 1554484333 -7200 # Node ID 4e99005cf917f271daa48366e7ad81f874d18fe5 # Parent 5b15ce870a5b08ac0fffecda4748bf5de4e4ee06 mod_invite: Show a different error if no token has been given The token "" having expired makes little sense diff -r 5b15ce870a5b -r 4e99005cf917 mod_invite/mod_invite.lua --- a/mod_invite/mod_invite.lua Fri Apr 05 19:10:59 2019 +0200 +++ b/mod_invite/mod_invite.lua Fri Apr 05 19:12:13 2019 +0200 @@ -41,7 +41,12 @@ response.headers.content_type = "text/html; charset=utf-8"; - if not token or not tokens[token] then + if not token or token == "" then + local template = assert(module:load_resource("invite/invite_result.html")):read("*a"); + + -- TODO maybe show a friendlier information page instead? + return apply_template(template, { classes = "alert-danger", message = "No token given" }) + elseif not tokens[token] then local template = assert(module:load_resource("invite/invite_result.html")):read("*a"); return apply_template(template, { classes = "alert-danger", message = "This invite has expired." })