From 04a2c8ed2f41de55b2852703cdcecec4a84223c4 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 17 May 2019 16:35:47 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E7=99=BB=E5=BD=95=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- session/oauth.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/session/oauth.go b/session/oauth.go index 11abb53..f83300c 100644 --- a/session/oauth.go +++ b/session/oauth.go @@ -16,7 +16,6 @@ package session import ( "crypto/tls" - "github.com/b3log/wide/i18n" "html/template" "math/rand" "net/http" @@ -27,6 +26,7 @@ import ( "time" "github.com/b3log/wide/conf" + "github.com/b3log/wide/i18n" "github.com/b3log/wide/util" "github.com/parnurzeal/gorequest" ) @@ -89,15 +89,14 @@ func GithubCallbackHandler(w http.ResponseWriter, r *http.Request) { userName := githubUser["userName"].(string) avatar := githubUser["userAvatarURL"].(string) - result := util.NewResult() - defer util.RetResult(w, r, result) - user := conf.GetUser(githubId) if nil == user { msg := addUser(githubId, userName, avatar) if userCreated != msg { + result := util.NewResult() result.Succ = false result.Msg = msg + util.RetResult(w, r, result) return }