mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 20:51:43 +00:00
[Backport 5.3.9104] Redirect to sign-in provider when there is only one (#62007)
This PR makes the sign-in page always redirect if there is only a single sign-in provider, since there is nothing else to do on the sign in page otherwise.
## Test plan
Verified to work locally
<!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles
Why does it matter?
These test plans are there to demonstrate that are following industry standards which are important or critical for our customers.
They might be read by customers or an auditor. There are meant be simple and easy to read. Simply explain what you did to ensure
your changes are correct!
Here are a non exhaustive list of test plan examples to help you:
- Making changes on a given feature or component:
- "Covered by existing tests" or "CI" for the shortest possible plan if there is zero ambiguity
- "Added new tests"
- "Manually tested" (if non trivial, share some output, logs, or screenshot)
- Updating docs:
- "previewed locally"
- share a screenshot if you want to be thorough
- Updating deps, that would typically fail immediately in CI if incorrect
- "CI"
- "locally tested"
-->
Backport 5653a5f from #61919
This commit is contained in:
parent
6f88a0c820
commit
fd30e59cd4
@ -86,8 +86,8 @@ export const SignInPage: React.FunctionComponent<React.PropsWithChildren<SignInP
|
||||
}
|
||||
|
||||
const thirdPartyAuthProviders = nonBuiltinAuthProviders.filter(provider => shouldShowProvider(provider))
|
||||
// If there is only one auth provider that is going to be displayed on dotcom, we want to redirect to it directly.
|
||||
if (context.sourcegraphDotComMode && thirdPartyAuthProviders.length === 1) {
|
||||
// If there is only one auth provider that is going to be displayed, we want to redirect to it directly.
|
||||
if (thirdPartyAuthProviders.length === 1 && !builtInAuthProvider) {
|
||||
// Add '?returnTo=' + encodeURIComponent(returnTo) to thirdPartyAuthProviders[0].authenticationURL in a safe way.
|
||||
const redirectUrl = new URL(thirdPartyAuthProviders[0].authenticationURL, window.location.href)
|
||||
if (returnTo) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user