mirror of
https://github.com/go-gitea/gitea
synced 2025-07-19 08:48:37 +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:
@@ -626,10 +626,14 @@ func (err ErrOAuthApplicationNotFound) Unwrap() error {
|
||||
return util.ErrNotExist
|
||||
}
|
||||
|
||||
// GetActiveOAuth2ProviderSources returns all actived LoginOAuth2 sources
|
||||
func GetActiveOAuth2ProviderSources() ([]*Source, error) {
|
||||
// GetOAuth2ProviderSources returns all actived LoginOAuth2 sources
|
||||
func GetOAuth2ProviderSources(onlyActive bool) ([]*Source, error) {
|
||||
sources := make([]*Source, 0, 1)
|
||||
if err := db.GetEngine(db.DefaultContext).Where("is_active = ? and type = ?", true, OAuth2).Find(&sources); err != nil {
|
||||
sess := db.GetEngine(db.DefaultContext)
|
||||
if onlyActive {
|
||||
sess = sess.Where("is_active = ?", true)
|
||||
}
|
||||
if err := sess.Where("type = ?", OAuth2).Find(&sources); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return sources, nil
|
||||
|
Reference in New Issue
Block a user