Software /
code /
prosody-modules
Comparison
mod_register_web/mod_register_web.lua @ 1618:c56baec031e8
mod_register_web: Send Content-Type headers
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 26 Feb 2015 15:31:25 +0100 |
parent | 1572:1aa894db3585 |
child | 1778:32604bf33a4c |
comparison
equal
deleted
inserted
replaced
1617:e0d8caffa209 | 1618:c56baec031e8 |
---|---|
99 end | 99 end |
100 end | 100 end |
101 end | 101 end |
102 | 102 |
103 function generate_page(event, display_options) | 103 function generate_page(event, display_options) |
104 local request = event.request; | 104 local request, response = event.request, event.response; |
105 | 105 |
106 response.headers.content_type = "text/html; charset=utf-8"; | |
106 return render(register_tpl, { | 107 return render(register_tpl, { |
107 path = request.path; hostname = module.host; | 108 path = request.path; hostname = module.host; |
108 notice = display_options and display_options.register_error or ""; | 109 notice = display_options and display_options.register_error or ""; |
109 captcha = generate_captcha(display_options); | 110 captcha = generate_captcha(display_options); |
110 }) | 111 }) |
152 return render(success_tpl, { jid = nodeprep(form.username).."@"..module.host }); | 153 return render(success_tpl, { jid = nodeprep(form.username).."@"..module.host }); |
153 end | 154 end |
154 | 155 |
155 function generate_register_response(event, form, ok, err) | 156 function generate_register_response(event, form, ok, err) |
156 local message; | 157 local message; |
158 event.response.headers.content_type = "text/html; charset=utf-8"; | |
157 if ok then | 159 if ok then |
158 return generate_success(event, form); | 160 return generate_success(event, form); |
159 else | 161 else |
160 return generate_page(event, { register_error = err }); | 162 return generate_page(event, { register_error = err }); |
161 end | 163 end |