Skip to content

Commit

Permalink
Suppress ExternalLoginUserNotExist error (#21504) (#21572)
Browse files Browse the repository at this point in the history
Backport of #21504

Co-authored-by: Lunny Xiao <[email protected]>
  • Loading branch information
KN4CK3R and lunny authored Oct 25, 2022
1 parent 169c08e commit 2ccf940
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion routers/web/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,9 @@ func handleUserCreated(ctx *context.Context, u *user_model.User, gothUser *goth.
// update external user information
if gothUser != nil {
if err := externalaccount.UpdateExternalUser(u, *gothUser); err != nil {
log.Error("UpdateExternalUser failed: %v", err)
if !user_model.IsErrExternalLoginUserNotExist(err) {
log.Error("UpdateExternalUser failed: %v", err)
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion routers/web/auth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,9 @@ func handleOAuth2SignIn(ctx *context.Context, source *auth.Source, u *user_model

// update external user information
if err := externalaccount.UpdateExternalUser(u, gothUser); err != nil {
log.Error("UpdateExternalUser failed: %v", err)
if !user_model.IsErrExternalLoginUserNotExist(err) {
log.Error("UpdateExternalUser failed: %v", err)
}
}

if err := resetLocale(ctx, u); err != nil {
Expand Down

0 comments on commit 2ccf940

Please sign in to comment.