feat(admin): support newline input for redirect URIs via tag picker#167
feat(admin): support newline input for redirect URIs via tag picker#167
Conversation
- Convert the Redirect URIs field to a tag-based picker matching the scopes input - Accept commas or newlines as separators in the backend parser - Add table-driven tests covering newline, CRLF, and mixed separator inputs Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds a redirect URI tag-picker UI (matching the existing scopes picker) and extends server-side parsing to accept newline-separated redirect URI input, improving paste/entry UX across admin and user app forms.
Changes:
- Replaces Redirect URIs textarea with a tag-based picker (hidden input + JS-managed tags) and adds matching CSS.
- Updates
parseRedirectURIsto split on commas and newline/CRLF. - Extends
Test_parseRedirectURIswith newline/CRLF/mixed/whitespace/blank-line cases.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/templates/static/css/pages/admin-forms.css | Adds styling for the redirect URI tag picker and reduced-motion handling. |
| internal/templates/client_shared.templ | Swaps Redirect URIs textarea for tag picker markup and adds picker JS. |
| internal/handlers/utils.go | Changes how redirect URIs are formatted for template display (clientToDisplay). |
| internal/handlers/client_test.go | Adds test cases for newline/CRLF parsing and whitespace/blank-line handling. |
| internal/handlers/client.go | Updates parseRedirectURIs to accept commas and newline separators. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Keep clientToDisplay joining RedirectURIs with ", " so detail templates render the list readably instead of a whitespace-collapsed blob - Return a non-nil empty slice from parseRedirectURIs so callers and tests do not need to special-case nil Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Read paste data via clipboardData.getData("text/plain") with an IE fallback for reliable cross-browser behavior
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Drop the admin-uri-tag-remove exclusion so clicks anywhere in the picker send focus back to the text input, matching scope picker behavior - Tighten hint copy to use "newlines" as one word Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Split redirect URIs on commas and newlines only, matching parseRedirectURIs, so pasted tab or space-separated text no longer splits differently on the client Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
/admin/clients/new,/admin/clients/:id/edit,/apps/new, and/apps/:idinto a tag-based picker that matches the existing Scopes input.parseRedirectURIs, so admins can paste multi-line lists from any source (previously only commas worked).Test_parseRedirectURIswith newline, CRLF, mixed comma+newline, blank-line, and surrounding-whitespace cases.Test plan
make generate && make fmt && make lint— all greenmake test—Test_parseRedirectURIspasses all 16 cases./bin/authgate server→/admin/clients/new: enter a URI and press Enter; paste a comma-separated list; paste a newline-separated list; remove one with × — all produce the expected tag set and the created client stores every URI./admin/clients/:id/edit: open an existing client with multiple URIs; confirm they render as tags; remove one and submit; DB reflects the change./apps/new(regular user app form): same flow works.🤖 Generated with Claude Code