ptit test parce que le csrf marche pas en prod + commentaires exo
This commit is contained in:
parent
1661636490
commit
57de482cd9
2 changed files with 11 additions and 11 deletions
4
api.php
4
api.php
|
@ -185,10 +185,10 @@
|
|||
case "aj_doc":
|
||||
|
||||
|
||||
if(!$csrf->validate($context='televersement',$_POST["jeton-csrf"])){
|
||||
/*if(!$csrf->validate($context='televersement',$_POST["jeton-csrf"])){
|
||||
echo( json_encode(["status"=> "2","msg"=>"jeton csrf manquant.".$_POST["jeton-csrf"]]) );
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
try{
|
||||
ajouter_doc($_POST);
|
||||
|
|
|
@ -63,18 +63,16 @@ function uploadFiles() {
|
|||
|
||||
//let ex = [{duree:"10",themes:["algèbre","analyse"],commentaire_exo:"ceci est un commenataire"},{duree:"15",themes:["elec analogique"],commentaire_exo:""}];
|
||||
|
||||
let ex = [];
|
||||
|
||||
var ex = [];
|
||||
// details des exos pour les annales
|
||||
if(formData["type"] == "1"){
|
||||
let details = document.getElementsByClassName("input-details-exo");
|
||||
if(formData.get("type") == "1"){
|
||||
var details = document.getElementsByClassName("input-details-exo");
|
||||
|
||||
for(let i=0;i<=details.length;i = i + 3){
|
||||
for(let i=0;i<details.length;i = i + 3){
|
||||
ex.push({
|
||||
// duree
|
||||
duree:details[i].getAttribute.value,
|
||||
themes:details[i+1].getAttribute.value.split(","),
|
||||
commentaire_exo:details[i+2].getAttribute.value
|
||||
duree:details[i].value,
|
||||
themes:details[i+1].value.split(","),
|
||||
commentaire_exo:details[i+2].value
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +88,8 @@ function uploadFiles() {
|
|||
i ++;
|
||||
}
|
||||
|
||||
console.log(ex);
|
||||
|
||||
//csrf token
|
||||
formData.append("jeton-csrf","<?=$csrf->string($context="televersement")?>");
|
||||
|
||||
|
|
Loading…
Reference in a new issue