admin: avoid CSRF: use POST instead of GET, mainly for synchronisation methods
This commit is contained in:
parent
9a1a64c41c
commit
87428909b2
4 changed files with 18 additions and 18 deletions
|
|
@ -23,7 +23,7 @@ func init() {
|
|||
router.GET("/api/teams/:tid/certificate.p12", apiHandler(teamHandler(GetTeamCertificate)))
|
||||
router.DELETE("/api/teams/:tid/certificate.p12", apiHandler(teamHandler(
|
||||
func(team fic.Team, _ []byte) (interface{}, error) { return team.RevokeCert() })))
|
||||
router.GET("/api/teams/:tid/certificate/generate", apiHandler(teamHandler(
|
||||
router.POST("/api/teams/:tid/certificate/generate", apiHandler(teamHandler(
|
||||
func(team fic.Team, _ []byte) (interface{}, error) { return team.GenerateCert() })))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,13 +42,13 @@ func init() {
|
|||
|
||||
|
||||
// Synchronize
|
||||
router.GET("/api/sync/exercices/:eid/files", apiHandler(exerciceHandler(
|
||||
router.POST("/api/sync/exercices/:eid/files", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceFiles(sync.GlobalImporter, exercice), nil })))
|
||||
router.GET("/api/sync/exercices/:eid/hints", apiHandler(exerciceHandler(
|
||||
router.POST("/api/sync/exercices/:eid/hints", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceHints(sync.GlobalImporter, exercice), nil })))
|
||||
router.GET("/api/sync/exercices/:eid/keys", apiHandler(exerciceHandler(
|
||||
router.POST("/api/sync/exercices/:eid/keys", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceKeys(sync.GlobalImporter, exercice), nil })))
|
||||
router.GET("/api/sync/exercices/:eid/quiz", apiHandler(exerciceHandler(
|
||||
router.POST("/api/sync/exercices/:eid/quiz", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceMCQ(sync.GlobalImporter, exercice), nil })))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,19 +45,19 @@ func init() {
|
|||
router.GET("/api/remote/themes/:thid/exercices", apiHandler(themeHandler(sync.ApiListRemoteExercices)))
|
||||
|
||||
// Synchronize
|
||||
router.GET("/api/sync/deep", apiHandler(
|
||||
router.POST("/api/sync/deep", apiHandler(
|
||||
func(_ httprouter.Params, _ []byte) (interface{}, error) { return sync.SyncDeep(sync.GlobalImporter), nil }))
|
||||
router.GET("/api/sync/themes", apiHandler(
|
||||
router.POST("/api/sync/themes", apiHandler(
|
||||
func(_ httprouter.Params, _ []byte) (interface{}, error) { return sync.SyncThemes(sync.GlobalImporter), nil }))
|
||||
router.GET("/api/sync/themes/:thid/exercices", apiHandler(themeHandler(
|
||||
router.POST("/api/sync/themes/:thid/exercices", apiHandler(themeHandler(
|
||||
func(theme fic.Theme, _ []byte) (interface{}, error) { return sync.SyncExercices(sync.GlobalImporter, theme), nil })))
|
||||
router.GET("/api/sync/themes/:thid/exercices/:eid/files", apiHandler(exerciceHandler(
|
||||
router.POST("/api/sync/themes/:thid/exercices/:eid/files", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceFiles(sync.GlobalImporter, exercice), nil })))
|
||||
router.GET("/api/sync/themes/:thid/exercices/:eid/hints", apiHandler(exerciceHandler(
|
||||
router.POST("/api/sync/themes/:thid/exercices/:eid/hints", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceHints(sync.GlobalImporter, exercice), nil })))
|
||||
router.GET("/api/sync/themes/:thid/exercices/:eid/keys", apiHandler(exerciceHandler(
|
||||
router.POST("/api/sync/themes/:thid/exercices/:eid/keys", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceKeys(sync.GlobalImporter, exercice), nil })))
|
||||
router.GET("/api/sync/themes/:thid/exercices/:eid/quiz", apiHandler(exerciceHandler(
|
||||
router.POST("/api/sync/themes/:thid/exercices/:eid/quiz", apiHandler(exerciceHandler(
|
||||
func(exercice fic.Exercice, _ []byte) (interface{}, error) { return sync.SyncExerciceMCQ(sync.GlobalImporter, exercice), nil })))
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue