🎨 登录验证

This commit is contained in:
Liang Ding 2019-05-17 16:35:47 +08:00
parent 1d802f8717
commit 04a2c8ed2f
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
1 changed files with 3 additions and 4 deletions

View File

@ -16,7 +16,6 @@ package session
import ( import (
"crypto/tls" "crypto/tls"
"github.com/b3log/wide/i18n"
"html/template" "html/template"
"math/rand" "math/rand"
"net/http" "net/http"
@ -27,6 +26,7 @@ import (
"time" "time"
"github.com/b3log/wide/conf" "github.com/b3log/wide/conf"
"github.com/b3log/wide/i18n"
"github.com/b3log/wide/util" "github.com/b3log/wide/util"
"github.com/parnurzeal/gorequest" "github.com/parnurzeal/gorequest"
) )
@ -89,15 +89,14 @@ func GithubCallbackHandler(w http.ResponseWriter, r *http.Request) {
userName := githubUser["userName"].(string) userName := githubUser["userName"].(string)
avatar := githubUser["userAvatarURL"].(string) avatar := githubUser["userAvatarURL"].(string)
result := util.NewResult()
defer util.RetResult(w, r, result)
user := conf.GetUser(githubId) user := conf.GetUser(githubId)
if nil == user { if nil == user {
msg := addUser(githubId, userName, avatar) msg := addUser(githubId, userName, avatar)
if userCreated != msg { if userCreated != msg {
result := util.NewResult()
result.Succ = false result.Succ = false
result.Msg = msg result.Msg = msg
util.RetResult(w, r, result)
return return
} }