Loading
Guard device OAuth confirm and unify admin warning
What does this MR do and why?
Follow-up to !246419 (merged), addressing two questions raised in review there.
- Bug fix:
Oauth::DeviceAuthorizationsController#confirmrendered the authorize/confirm page for any submitteduser_code, including invalid, blank, expired, or already-consumed ones. Users saw the admin escalation warning and a working "Confirm" button for a grant that matched nothing.confirmnow returns doorkeeper's own error response (authorization_error_response(:invalid_user_code)or(:expired_user_code)) when the device grant is missing or expired, redirecting back to the device code entry page with a flash error instead. - Maintenance/copy consolidation: the admin-escalation warning existed as two near-duplicate translated strings across the regular OAuth consent, device OAuth, and IAM consent screens. Since
confirmnow guarantees a real grant, the device authorize page always has an application, making its nameless fallback string and@applicationnil-guards dead code. Removed both and unified all three screens onto a single parameterized string that keeps the interpolated, bolded client name. Removed the two orphaned strings fromlocale/gitlab.pot.
References
How to set up and validate locally
- Sign in as an administrator.
- Visit
/oauth/device. - Enter a random or invalid code and submit. Confirm you are redirected back to the code entry page with an error, instead of seeing a confirm page with the admin warning and a "Confirm" button.
- Create an OAuth application, then start a real device grant (or use the regular OAuth consent flow at
/oauth/authorize). - Confirm the admin escalation warning names the application, using the same wording across the device, regular, and IAM consent screens.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Eduardo Sanz García