Redirect to the only OAuth2 provider when no other login methods and fix various problems#36901
Conversation
|
I included it because it was mentioned in this comment, it could be used if auth source is unavailable. What do you suggest, should I?
|
|
@wxiaoguang I have added some tests. Could you check this now please? |
I don't understand it |
|
Sorry for being vague.
I think you asked here about why I included the In the reply, I mentioned that it was a design choice specified by @silverwind while accepting the feature proposal in this issue's (#36846 ) discussion.
Here I asked you, if I should remove the |
As I said, I don't understand it. You are the author so you need to propose reasonable and feasible designs. |
|
You can explain your design by answering the questions:
|
There was a problem hiding this comment.
Pull request overview
Adds an auto-redirect behavior on the /login page to streamline sign-in when only a single OAuth2 auth source is available and all other sign-in methods are disabled, with a skipAutoLogin=true escape hatch.
Changes:
- Implement
performAutoLoginOAuth2and invoke it fromSignInunder a “OAuth2-only” configuration. - Add a unit test covering the auto-redirect behavior and
skipAutoLoginbypass.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
routers/web/auth/auth.go |
Adds OAuth2-only auto-redirect logic when rendering /login. |
routers/web/auth/auth_test.go |
Adds a unit test validating redirect + bypass behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I have to correct my request: |
|
Thank you everyone for the review, and sorry for the late reply. I have removed the |
This comment was written by Claude Opus 4.6. |
998eeef to
b10e68b
Compare
|
Would still add those test cases mentioned in #36901 (comment). If you like I can exercise AI on it, or you do it yourself. |
Have you read the new code by yourself?
|
|
Ok, but a test with 2 providers is still missing it seems? |
* origin/main: Update JS dependencies and misc tweaks (go-gitea#37064) Redirect to the only OAuth2 provider when no other login methods and fix various problems (go-gitea#36901) Show workflow link (go-gitea#37070) Remove leftover `webpackChunkName` comments from codeeditor (go-gitea#37062) Update Go dependencies (go-gitea#36781) Add webhook name field to improve webhook identification (go-gitea#37025) (go-gitea#37040) Upgrade `go-git` to v5.17.2 (go-gitea#37060) Replace Monaco with CodeMirror (go-gitea#36764) Update Combine method to treat warnings as failures and adjust tests (go-gitea#37048) Raise minimum Node.js version to 22.18.0 (go-gitea#37058) Update golangci-lint to v2.11.4 (go-gitea#37059) Upgrade `golang.org/x/image` to v0.38.0 (go-gitea#37054) # Conflicts: # web_src/css/themes/theme-gitea-dark.css
* main: Fix NuGet package upload error handling (go-gitea#37074) Desaturate dark theme background colors (go-gitea#37056) Update JS dependencies and misc tweaks (go-gitea#37064) Redirect to the only OAuth2 provider when no other login methods and fix various problems (go-gitea#36901) Show workflow link (go-gitea#37070) Remove leftover `webpackChunkName` comments from codeeditor (go-gitea#37062) Update Go dependencies (go-gitea#36781) Add webhook name field to improve webhook identification (go-gitea#37025) (go-gitea#37040) Upgrade `go-git` to v5.17.2 (go-gitea#37060) Replace Monaco with CodeMirror (go-gitea#36764) Update Combine method to treat warnings as failures and adjust tests (go-gitea#37048) Raise minimum Node.js version to 22.18.0 (go-gitea#37058) Update golangci-lint to v2.11.4 (go-gitea#37059) Upgrade `golang.org/x/image` to v0.38.0 (go-gitea#37054) Increase e2e test timeouts on CI to fix flaky tests (go-gitea#37053) Refactor "org teams" page and help new users to "add member" to an org (go-gitea#37051)
* origin/main: (192 commits) Fix NuGet package upload error handling (go-gitea#37074) Desaturate dark theme background colors (go-gitea#37056) Update JS dependencies and misc tweaks (go-gitea#37064) Redirect to the only OAuth2 provider when no other login methods and fix various problems (go-gitea#36901) Show workflow link (go-gitea#37070) Remove leftover `webpackChunkName` comments from codeeditor (go-gitea#37062) Update Go dependencies (go-gitea#36781) Add webhook name field to improve webhook identification (go-gitea#37025) (go-gitea#37040) Upgrade `go-git` to v5.17.2 (go-gitea#37060) Replace Monaco with CodeMirror (go-gitea#36764) Update Combine method to treat warnings as failures and adjust tests (go-gitea#37048) Raise minimum Node.js version to 22.18.0 (go-gitea#37058) Update golangci-lint to v2.11.4 (go-gitea#37059) Upgrade `golang.org/x/image` to v0.38.0 (go-gitea#37054) Increase e2e test timeouts on CI to fix flaky tests (go-gitea#37053) Refactor "org teams" page and help new users to "add member" to an org (go-gitea#37051) Refactor issue sidebar and fix various problems (go-gitea#37045) Add tests for pull request's content_version in API (go-gitea#37044) Enable concurrent vitest execution (go-gitea#36998) Fix theme discovery and Vite dev server in dev mode (go-gitea#37033) ... # Conflicts: # templates/user/dashboard/feeds.tmpl



Fixes: #36846