Mercurial > prosody-modules
comparison mod_http_oauth2/mod_http_oauth2.lua @ 5608:1893ae742f66
mod_http_oauth2: Show errors on device flow user code entry page
If the user enters the code incorrectly, having to click back to try
again is no fun. Instead, show the error and the code entry form again.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 19 Jul 2023 13:05:47 +0200 |
parents | ad9b8f659c96 |
children | 7565298aa197 |
comparison
equal
deleted
inserted
replaced
5607:ad9b8f659c96 | 5608:1893ae742f66 |
---|---|
1009 return render_page(templates.device, { client = false }); | 1009 return render_page(templates.device, { client = false }); |
1010 end | 1010 end |
1011 | 1011 |
1012 local device_info = codes:get("user_code:" .. params.user_code); | 1012 local device_info = codes:get("user_code:" .. params.user_code); |
1013 if not device_info or code_expired(device_info) or not codes:set("user_code:" .. params.user_code, nil) then | 1013 if not device_info or code_expired(device_info) or not codes:set("user_code:" .. params.user_code, nil) then |
1014 return render_error(oauth_error("expired_token", "Incorrect or expired code")); | 1014 return render_page(templates.device, { |
1015 client = false; | |
1016 error = oauth_error("expired_token", "Incorrect or expired code"); | |
1017 }); | |
1015 end | 1018 end |
1016 | 1019 |
1017 return { | 1020 return { |
1018 status_code = 303; | 1021 status_code = 303; |
1019 headers = { | 1022 headers = { |