mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-01 15:19:09 +01:00
parent
ec9b43ba16
commit
37458bffbf
1 changed files with 5 additions and 1 deletions
|
@ -512,10 +512,14 @@ func GetActiveOAuth2ProviderSources() ([]*Source, error) {
|
||||||
func GetActiveOAuth2SourceByName(name string) (*Source, error) {
|
func GetActiveOAuth2SourceByName(name string) (*Source, error) {
|
||||||
authSource := new(Source)
|
authSource := new(Source)
|
||||||
has, err := db.GetEngine(db.DefaultContext).Where("name = ? and type = ? and is_active = ?", name, OAuth2, true).Get(authSource)
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !has {
|
||||||
|
return nil, fmt.Errorf("oauth2 source not found, name: %q", name)
|
||||||
|
}
|
||||||
|
|
||||||
return authSource, nil
|
return authSource, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue