Mercurial > prosody-modules
comparison mod_invite/mod_invite.lua @ 3552:5370bc374c83
mod_invite: Use path passed by http stack instead of pattern matching
Otherwise this breaks in case http_paths is used to serve from a different path than /invite/
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 05 Apr 2019 19:06:20 +0200 |
parents | b059a3fb2a58 |
children | 5b15ce870a5b |
comparison
equal
deleted
inserted
replaced
3551:7fc6a63c3bd0 | 3552:5370bc374c83 |
---|---|
32 return k | 32 return k |
33 end | 33 end |
34 end) | 34 end) |
35 end | 35 end |
36 | 36 |
37 function generate_page(event) | 37 function generate_page(event, token) |
38 local request, response = event.request, event.response; | 38 local request, response = event.request, event.response; |
39 | 39 |
40 local tokens = invite_storage:get() or {}; | 40 local tokens = invite_storage:get() or {}; |
41 | |
42 local token = request.path:match("^/invite/([^/]*)$"); | |
43 | 41 |
44 response.headers.content_type = "text/html; charset=utf-8"; | 42 response.headers.content_type = "text/html; charset=utf-8"; |
45 | 43 |
46 if not token or not tokens[token] then | 44 if not token or not tokens[token] then |
47 local template = assert(module:load_resource("invite/invite_result.html")):read("*a"); | 45 local template = assert(module:load_resource("invite/invite_result.html")):read("*a"); |