Add debug info to catch forwarded client IP

This commit is contained in:
Andrea Fazzi 2021-01-10 17:49:03 +01:00
parent 339d087ab3
commit d884404956
2 changed files with 2 additions and 1 deletions

View file

@ -125,6 +125,8 @@ func (c *Contest) Read(db *Database, args map[string]string, w http.ResponseWrit
func (c *Contest) ReadAll(db *Database, args map[string]string, w http.ResponseWriter, r *http.Request) (interface{}, error) {
var contests []*Contest
log.Println(r.Header)
claims := r.Context().Value("user").(*jwt.Token).Claims.(jwt.MapClaims)
if claims["admin"].(bool) {

View file

@ -54,7 +54,6 @@ func WriteCreator(r *http.Request, modifier Modifier) {
modifier.SetCreatorID(getUserIDFromTokenAsUint(r))
modifier.SetCreatorRole(getUserRole(r))
modifier.SetCreatorIP(r.RemoteAddr)
}
func WriteUpdater(r *http.Request, modifier Modifier) {