🎨 登录验证

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 (
"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
}