🔇 减少日志
This commit is contained in:
parent
359ce01227
commit
29d4d93019
|
@ -66,15 +66,10 @@ func RedirectGitHubHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
state := util.Rand.String(16) + referer
|
state := util.Rand.String(16) + referer
|
||||||
states[state] = state
|
states[state] = state
|
||||||
path := loginAuthURL + "?client_id=" + clientId + "&state=" + state + "&scope=public_repo,read:user,user:follow"
|
path := loginAuthURL + "?client_id=" + clientId + "&state=" + state + "&scope=public_repo,read:user,user:follow"
|
||||||
|
|
||||||
logger.Infof("redirect to github [" + path + "]")
|
|
||||||
|
|
||||||
http.Redirect(w, r, path, http.StatusSeeOther)
|
http.Redirect(w, r, path, http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GithubCallbackHandler(w http.ResponseWriter, r *http.Request) {
|
func GithubCallbackHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
logger.Infof("Github callback [" + r.URL.String() + "]")
|
|
||||||
|
|
||||||
state := r.URL.Query().Get("state")
|
state := r.URL.Query().Get("state")
|
||||||
if _, exist := states[state]; !exist {
|
if _, exist := states[state]; !exist {
|
||||||
http.Error(w, "Get state param failed", http.StatusBadRequest)
|
http.Error(w, "Get state param failed", http.StatusBadRequest)
|
||||||
|
@ -120,8 +115,6 @@ func GithubCallbackHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
httpSession.Values["id"] = strconv.Itoa(rand.Int())
|
httpSession.Values["id"] = strconv.Itoa(rand.Int())
|
||||||
httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge
|
httpSession.Options.MaxAge = conf.Wide.HTTPSessionMaxAge
|
||||||
httpSession.Save(r, w)
|
httpSession.Save(r, w)
|
||||||
|
|
||||||
logger.Debugf("Created a HTTP session [%s] for user [%s]", httpSession.Values["id"].(string), githubId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GitHubUserInfo returns GitHub user info specified by the given access token.
|
// GitHubUserInfo returns GitHub user info specified by the given access token.
|
||||||
|
|
Loading…
Reference in New Issue