Mercurial > prosody-modules
comparison mod_http_oauth2/mod_http_oauth2.lua @ 6408:7fe484e7b574
mod_http_oauth2: Make error template optional
Would fall back to mod_http_errors
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 18 Feb 2026 16:35:30 +0100 |
| parents | 3f0970babd67 |
| children | ff55e93be449 |
comparison
equal
deleted
inserted
replaced
| 6407:6ebda1e5b4f3 | 6408:7fe484e7b574 |
|---|---|
| 100 local templates = { | 100 local templates = { |
| 101 login = read_file(template_path, "login.html", true); | 101 login = read_file(template_path, "login.html", true); |
| 102 consent = read_file(template_path, "consent.html", true); | 102 consent = read_file(template_path, "consent.html", true); |
| 103 oob = read_file(template_path, "oob.html", true); | 103 oob = read_file(template_path, "oob.html", true); |
| 104 device = read_file(template_path, "device.html", true); | 104 device = read_file(template_path, "device.html", true); |
| 105 error = read_file(template_path, "error.html", true); | 105 error = read_file(template_path, "error.html"); |
| 106 css = read_file(template_path, "style.css"); | 106 css = read_file(template_path, "style.css"); |
| 107 js = read_file(template_path, "script.js"); | 107 js = read_file(template_path, "script.js"); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 local site_name = module:get_option_string("site_name", module.host); | 110 local site_name = module:get_option_string("site_name", module.host); |
| 805 response_type_handlers.token = nil; | 805 response_type_handlers.token = nil; |
| 806 grant_type_handlers.authorization_code = nil; | 806 grant_type_handlers.authorization_code = nil; |
| 807 end | 807 end |
| 808 | 808 |
| 809 local function render_error(err) | 809 local function render_error(err) |
| 810 if not templates.error then return err or 500; end | |
| 810 return render_page(templates.error, { error = err }); | 811 return render_page(templates.error, { error = err }); |
| 811 end | 812 end |
| 812 | 813 |
| 813 -- OAuth errors should be returned to the client if possible, i.e. by | 814 -- OAuth errors should be returned to the client if possible, i.e. by |
| 814 -- appending the error information to the redirect_uri and sending the | 815 -- appending the error information to the redirect_uri and sending the |
