mirror of
https://github.com/go-gitea/gitea
synced 2025-07-25 19:58:36 +00:00
Fix bug when the linked account was disactived and list the linked accounts (#29263)
The bug has been fixed on v1.22 but not backport to v1.21. This original PR have many refactors so I don't think it's necessary to backport all of them. Fix #28667
This commit is contained in:
@@ -62,7 +62,7 @@ func ResetOAuth2() error {
|
||||
|
||||
// initOAuth2Sources is used to load and register all active OAuth2 providers
|
||||
func initOAuth2Sources() error {
|
||||
authSources, _ := auth.GetActiveOAuth2ProviderSources()
|
||||
authSources, _ := auth.GetOAuth2ProviderSources(true)
|
||||
for _, source := range authSources {
|
||||
oauth2Source, ok := source.Cfg.(*Source)
|
||||
if !ok {
|
||||
|
@@ -94,13 +94,12 @@ func GetOAuth2Providers() []Provider {
|
||||
return providers
|
||||
}
|
||||
|
||||
// GetActiveOAuth2Providers returns the map of configured active OAuth2 providers
|
||||
// GetOAuth2ProvidersMap returns the map of configured active OAuth2 providers
|
||||
// key is used as technical name (like in the callbackURL)
|
||||
// values to display
|
||||
func GetActiveOAuth2Providers() ([]string, map[string]Provider, error) {
|
||||
func GetOAuth2ProvidersMap(onlyActive bool) ([]string, map[string]Provider, error) {
|
||||
// Maybe also separate used and unused providers so we can force the registration of only 1 active provider for each type
|
||||
|
||||
authSources, err := auth.GetActiveOAuth2ProviderSources()
|
||||
authSources, err := auth.GetOAuth2ProviderSources(onlyActive)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user