From 27230530396e7565598e46269f4242d73c9a70ac Mon Sep 17 00:00:00 2001 From: Adhityaa Date: Thu, 7 Jun 2018 13:14:19 +0530 Subject: [PATCH] oauth_google_callback.go: use commenterGetByEmail --- api/oauth_google_callback.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/oauth_google_callback.go b/api/oauth_google_callback.go index 2bed513..2f4acba 100644 --- a/api/oauth_google_callback.go +++ b/api/oauth_google_callback.go @@ -39,8 +39,8 @@ func googleCallbackHandler(w http.ResponseWriter, r *http.Request) { return } - exists, err := commenterIsProviderUser("google", user["email"].(string)) - if err != nil { + c, err := commenterGetByEmail("google", user["email"].(string)) + if err != nil && err != errorNoSuchCommenter { fmt.Fprintf(w, "Error: %s", err.Error()) return } @@ -69,6 +69,8 @@ func googleCallbackHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Error: %s", err.Error()) return } + } else { + commenterHex = c.CommenterHex } if err := commenterSessionUpdate(session, commenterHex); err != nil {