2016-12-09 08:36:18 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net/http"
|
2017-11-22 00:52:08 +00:00
|
|
|
"path"
|
2016-12-09 08:36:18 +00:00
|
|
|
)
|
|
|
|
|
2016-12-30 11:45:14 +00:00
|
|
|
var denyNameChange bool = true
|
|
|
|
|
2017-11-22 00:52:08 +00:00
|
|
|
func ChNameHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
|
2016-12-30 11:45:14 +00:00
|
|
|
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
|
2016-12-09 08:36:18 +00:00
|
|
|
http.Error(w, "{\"errmsg\":\"Demande de changement de nom acceptée\"}", http.StatusAccepted)
|
|
|
|
}
|
|
|
|
}
|