1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

oauth_google_callback.go: use error to detect auth

This commit is contained in:
Adhityaa
2018-06-07 13:13:02 +05:30
parent 36f281ec44
commit a066062f8b
2 changed files with 12 additions and 16 deletions

View File

@ -6,16 +6,17 @@ import (
)
func googleRedirectHandler(w http.ResponseWriter, r *http.Request) {
session := r.FormValue("session")
c, err := commenterGetBySession(session)
if err != nil {
fmt.Fprintf(w, "error: %s\n", err.Error())
if googleConfig == nil {
logger.Errorf("google oauth access attempt without configuration")
fmt.Fprintf(w, "error: this website has not configured Google OAuth")
return
}
if c.CommenterHex != "none" {
fmt.Fprintf(w, "error: that session is already in use\n")
session := r.FormValue("session")
_, err := commenterGetBySession(session)
if err != nil && err != errorNoSuchSession {
fmt.Fprintf(w, "error: %s\n", err.Error())
return
}