summaryrefslogtreecommitdiffstats
path: root/models/auth
diff options
context:
space:
mode:
Diffstat (limited to 'models/auth')
-rw-r--r--models/auth/oauth2.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/models/auth/oauth2.go b/models/auth/oauth2.go
index 5a58ec62b7..ad1d80e25a 100644
--- a/models/auth/oauth2.go
+++ b/models/auth/oauth2.go
@@ -512,10 +512,14 @@ func GetActiveOAuth2ProviderSources() ([]*Source, error) {
func GetActiveOAuth2SourceByName(name string) (*Source, error) {
authSource := new(Source)
has, err := db.GetEngine(db.DefaultContext).Where("name = ? and type = ? and is_active = ?", name, OAuth2, true).Get(authSource)
- if !has || err != nil {
+ if err != nil {
return nil, err
}
+ if !has {
+ return nil, fmt.Errorf("oauth2 source not found, name: %q", name)
+ }
+
return authSource, nil
}