Skip to content

Commit

Permalink
Filter inactive auth sources (#27870)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KN4CK3R authored Nov 1, 2023
1 parent 9b6e77c commit e378545
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routers/web/user/setting/security/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e378545

Please sign in to comment.