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:
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user