comparison mod_invite/mod_invite.lua @ 3554:4e99005cf917

mod_invite: Show a different error if no token has been given The token "" having expired makes little sense
author Kim Alvefur <zash@zash.se>
date Fri, 05 Apr 2019 19:12:13 +0200
parents 5b15ce870a5b
children 5e69a4358053
comparison
equal deleted inserted replaced
3553:5b15ce870a5b 3554:4e99005cf917
39 39
40 local tokens = invite_storage:get() or {}; 40 local tokens = invite_storage:get() or {};
41 41
42 response.headers.content_type = "text/html; charset=utf-8"; 42 response.headers.content_type = "text/html; charset=utf-8";
43 43
44 if not token or not tokens[token] then 44 if not token or token == "" then
45 local template = assert(module:load_resource("invite/invite_result.html")):read("*a");
46
47 -- TODO maybe show a friendlier information page instead?
48 return apply_template(template, { classes = "alert-danger", message = "No token given" })
49 elseif not tokens[token] then
45 local template = assert(module:load_resource("invite/invite_result.html")):read("*a"); 50 local template = assert(module:load_resource("invite/invite_result.html")):read("*a");
46 51
47 return apply_template(template, { classes = "alert-danger", message = "This invite has expired." }) 52 return apply_template(template, { classes = "alert-danger", message = "This invite has expired." })
48 end 53 end
49 54