Skip to content

Allow OAuth signup through invitation links - #812

Merged
thomiceli merged 2 commits into
thomiceli:masterfrom
justadityaraj:fix/798-oauth-invitation
Oct 16, 2026
Merged

thomiceli merged 2 commits into
thomiceli:masterfrom
justadityaraj:fix/798-oauth-invitation

Conversation

@justadityaraj

Copy link
Copy Markdown
Contributor

Context

A valid invitation unlocks the password registration page when signup is disabled, but that invitation context was lost as soon as the user chose OAuth. The OAuth callback then treated the user as an ordinary disabled-signup attempt and redirected back to login.

Fixes #798.

Changes

  • Store the validated invitation ID in the existing session before OAuth begins.
  • Reuse one eligibility check across the OAuth callback, registration form, and registration submission.
  • Consume the invitation only after the OAuth account has been created successfully.

User impact

Invited users can now complete OAuth/OIDC registration while public signup remains disabled. Users without a usable invitation continue to be rejected.

Verification

  • Added an end-to-end regression to TestOIDCLoginPKCE; before the fix it stopped at /-/login instead of /oauth/register.
  • The regression runs an actual Opengist HTTP server and local mockoidc HTTP provider through discovery, authorization, token exchange, and userinfo, backed by SQLite with a cookie jar, PKCE, and CSRF-protected registration POST. It verifies both the blocked no-invitation path and successful invited account creation/invitation consumption.
  • go test ./internal/web/handlers/auth -run '^TestOIDCLoginPKCE$' -count=1 — passed.
  • go test ./internal/web/handlers/auth -count=1 — passed.
  • go vet ./internal/web/handlers/auth — passed.
  • golangci-lint v2.12.0 run --timeout=20m --disable=errcheck — 0 issues.
  • Translation check, npm ci, Vite production build, and embedded Windows backend build — passed.
  • go test ./... -p 1 -count=1 — all modified and relevant handler packages passed, including API v1, auth, gist, health, metrics, and settings. The repository-wide run still reports unrelated Windows failures in CLI log-file cleanup, Git symlink/default-branch assumptions, and Git HTTP authentication behavior; representative internal/git failures reproduce on untouched master.

@thomiceli
thomiceli merged commit 636a7c1 into thomiceli:master Oct 16, 2026
thomiceli added a commit to arunkls-rbrk/opengist that referenced this pull request Oct 19, 2026
Resolve the conflict in oauth_test.go with the invitation tests from thomiceli#812
by keeping both subtests. Those tests leave DisableSignup enabled, so the
re-authentication subtest now resets it before registering through OIDC.
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.

Invitations links don't properly override disabled signup when using OAuth login

2 participants