mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Refactor Find Sources and fix bug when view a user who belongs to an unactive auth source (#27798)
The steps to reproduce it. First, create a new oauth2 source. Then, a user login with this oauth2 source. Disable the oauth2 source. Visit users -> settings -> security, 500 will be displayed. This is because this page only load active Oauth2 sources but not all Oauth2 sources.
This commit is contained in:
		| @@ -631,15 +631,6 @@ func (err ErrOAuthApplicationNotFound) Unwrap() error { | ||||
| 	return util.ErrNotExist | ||||
| } | ||||
|  | ||||
| // GetActiveOAuth2ProviderSources returns all actived LoginOAuth2 sources | ||||
| func GetActiveOAuth2ProviderSources(ctx context.Context) ([]*Source, error) { | ||||
| 	sources := make([]*Source, 0, 1) | ||||
| 	if err := db.GetEngine(ctx).Where("is_active = ? and type = ?", true, OAuth2).Find(&sources); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return sources, nil | ||||
| } | ||||
|  | ||||
| // GetActiveOAuth2SourceByName returns a OAuth2 AuthSource based on the given name | ||||
| func GetActiveOAuth2SourceByName(ctx context.Context, name string) (*Source, error) { | ||||
| 	authSource := new(Source) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user