From 2ccf9404647b9bea98892f03901de776b423254f Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Tue, 25 Oct 2022 18:08:05 +0200 Subject: [PATCH] Suppress `ExternalLoginUserNotExist` error (#21504) (#21572) Backport of #21504 Co-authored-by: Lunny Xiao --- routers/web/auth/auth.go | 4 +++- routers/web/auth/oauth.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go index ea5c7232a8..bda6789d8d 100644 --- a/routers/web/auth/auth.go +++ b/routers/web/auth/auth.go @@ -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) + } } } diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go index a9fc39d019..0492d30656 100644 --- a/routers/web/auth/oauth.go +++ b/routers/web/auth/oauth.go @@ -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 { -- 2.39.5