aboutsummaryrefslogtreecommitdiffstats
path: root/models/auth/oauth2.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-11-03 09:41:00 +0800
committerGitHub <noreply@github.com>2023-11-03 01:41:00 +0000
commit1bf5527eac6b947010c8faf408f6747de2a2384f (patch)
treea78319354a20c1ca68d6ab78268ae9811a7f854c /models/auth/oauth2.go
parent80715ae5c7ca41a8ee2ad7b6459c587cc63195bf (diff)
downloadgitea-1bf5527eac6b947010c8faf408f6747de2a2384f.tar.gz
gitea-1bf5527eac6b947010c8faf408f6747de2a2384f.zip
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.
Diffstat (limited to 'models/auth/oauth2.go')
-rw-r--r--models/auth/oauth2.go9
1 files changed, 0 insertions, 9 deletions
diff --git a/models/auth/oauth2.go b/models/auth/oauth2.go
index d73ad6965d..76a4e9d835 100644
--- a/models/auth/oauth2.go
+++ b/models/auth/oauth2.go
@@ -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)