diff 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
line wrap: on
line diff
--- 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." })