server/receiver/chname.go

20 lines
607 B
Go
Raw Normal View History

package main
import (
"log"
"net/http"
2017-11-22 00:52:08 +00:00
"path"
)
var denyNameChange bool = true
2017-11-22 00:52:08 +00:00
func ChNameHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
if denyNameChange {
log.Printf("UNHANDELED %s name change request from %s: %s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
http.Error(w, "{\"errmsg\":\"Le changement de nom est prohibé.\"}", http.StatusForbidden)
2017-11-22 00:52:08 +00:00
} else if saveTeamFile(path.Join(team, "name"), w, r) {
// File enqueued for backend treatment
http.Error(w, "{\"errmsg\":\"Demande de changement de nom acceptée\"}", http.StatusAccepted)
}
}