🎨 登录验证
This commit is contained in:
parent
1d802f8717
commit
04a2c8ed2f
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue