frontend: deny hint reveal after challenge's end + respond with 410 GONE
This commit is contained in:
parent
0f48b27a04
commit
a06a256c21
@ -3,9 +3,15 @@ package main
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func HintHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
|
func HintHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
|
||||||
|
if time.Now().Sub(challengeEnd) > 0 {
|
||||||
|
http.Error(w, "{\"errmsg\":\"Le challenge est terminé, trop tard pour un indice !\"}", http.StatusGone)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Enqueue file for backend treatment
|
// Enqueue file for backend treatment
|
||||||
if saveTeamFile(path.Join(team, "hint"), w, r) {
|
if saveTeamFile(path.Join(team, "hint"), w, r) {
|
||||||
http.Error(w, "{\"errmsg\":\"Demande d'astuce acceptée...\"}", http.StatusAccepted)
|
http.Error(w, "{\"errmsg\":\"Demande d'astuce acceptée...\"}", http.StatusAccepted)
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func SubmissionHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
|
func SubmissionHandler(w http.ResponseWriter, r *http.Request, team string, sURL []string) {
|
||||||
if time.Now().Sub(challengeEnd) > 0 {
|
if time.Now().Sub(challengeEnd) > 0 {
|
||||||
http.Error(w, "{\"errmsg\":\"Vous ne pouvez plus soumettre, le challenge est terminé.\"}", http.StatusForbidden)
|
http.Error(w, "{\"errmsg\":\"Vous ne pouvez plus soumettre, le challenge est terminé.\"}", http.StatusGone)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user