diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2023-11-02 00:46:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-02 01:46:26 +0200 |
commit | e378545f3083990eb36ff5d72477662d9787280d (patch) | |
tree | d077d5ee1a593233946bbf02c26f5a56d809438d | |
parent | 9b6e77c489edf3af3a9782c977cc04fde7aa2fd9 (diff) | |
download | gitea-e378545f3083990eb36ff5d72477662d9787280d.tar.gz gitea-e378545f3083990eb36ff5d72477662d9787280d.zip |
Filter inactive auth sources (#27870)
Fix nil access for inactive auth sources.
> Render failed, failed to render template:
user/settings/security/security, error: template error:
builtin(static):user/settings/security/accountlinks:32:20 : executing
"user/settings/security/accountlinks" at <$providerData.IconHTML>: nil
pointer evaluating oauth2.Provider.IconHTML
Code tries to access the auth source of an `ExternalLoginUser` but the
list contains only the active auth sources.
-rw-r--r-- | routers/web/user/setting/security/security.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/user/setting/security/security.go b/routers/web/user/setting/security/security.go index c687f7314d..58c637e2b3 100644 --- a/routers/web/user/setting/security/security.go +++ b/routers/web/user/setting/security/security.go @@ -82,7 +82,7 @@ func loadSecurityData(ctx *context.Context) { // map the provider display name with the AuthSource sources := make(map[*auth_model.Source]string) for _, externalAccount := range accountLinks { - if authSource, err := auth_model.GetSourceByID(ctx, externalAccount.LoginSourceID); err == nil { + if authSource, err := auth_model.GetSourceByID(ctx, externalAccount.LoginSourceID); err == nil && authSource.IsActive { var providerDisplayName string type DisplayNamed interface { |