Skip to content

feat(admin): support newline input for redirect URIs via tag picker#167

Merged
appleboy merged 5 commits intomainfrom
feat/admin-redirect-uri-picker
Apr 19, 2026
Merged

feat(admin): support newline input for redirect URIs via tag picker#167
appleboy merged 5 commits intomainfrom
feat/admin-redirect-uri-picker

Conversation

@appleboy
Copy link
Copy Markdown
Member

Summary

  • Convert the Redirect URIs field on /admin/clients/new, /admin/clients/:id/edit, /apps/new, and /apps/:id into a tag-based picker that matches the existing Scopes input.
  • Accept commas or newlines as separators in parseRedirectURIs, so admins can paste multi-line lists from any source (previously only commas worked).
  • Pasting comma- or newline-separated text splits automatically into multiple tags; individual tags can be removed with a × button.
  • Extend Test_parseRedirectURIs with newline, CRLF, mixed comma+newline, blank-line, and surrounding-whitespace cases.

Test plan

  • make generate && make fmt && make lint — all green
  • make testTest_parseRedirectURIs passes 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.
  • Visually verify the picker's border / focus glow / hover state matches the Scopes picker directly above it.

🤖 Generated with Claude Code

- 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>
Copilot AI review requested due to automatic review settings April 19, 2026 08:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 parseRedirectURIs to split on commas and newline/CRLF.
  • Extends Test_parseRedirectURIs with 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.

Comment thread internal/handlers/utils.go Outdated
Comment thread internal/handlers/client.go
- 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/templates/client_shared.templ Outdated
- 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/templates/client_shared.templ Outdated
Comment thread internal/templates/client_shared.templ
- 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/templates/client_shared.templ
Comment thread internal/templates/static/css/pages/admin-forms.css
- 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@appleboy appleboy merged commit 1e42045 into main Apr 19, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants