-
Utilisateur non modifié
+
Utilisateur non ajouté, car le pseudo ou l'adresse mail existe déjà
-
Vous avez créer l'utilisateur
+
Vous avez créée l'utilisateur
-
+
+
Erreur d'entrée dans le formulaire
+
+
+
Erreur inconnue
@@ -164,8 +169,8 @@
- Pseudo
-
+ Pseudo
+
diff --git a/web/html/user.html b/web/html/user.html
index 4d3b390..2519a17 100644
--- a/web/html/user.html
+++ b/web/html/user.html
@@ -150,7 +150,7 @@
-
- Pseudo
-
+ Pseudo
+
diff --git a/web/html/users.html b/web/html/users.html
index 20d5177..1704286 100644
--- a/web/html/users.html
+++ b/web/html/users.html
@@ -156,23 +156,33 @@
+
+
+
+
+
+
+ |
ID |
- Pseudo |
+ Username |
Mail |
Rôle |
Statut |
+ |
+ |
|
|
|
|
ActivéDésactivéEn attente de confirmationEn attente de suppressionStatut inconnu |
+ |
diff --git a/web/js/addUser.js b/web/js/addUser.js
index 766d6d7..ca19c5a 100644
--- a/web/js/addUser.js
+++ b/web/js/addUser.js
@@ -4,7 +4,7 @@ closeButton();
document.getElementById("addUser").addEventListener("click", function(){
- var updateProfil = ["pseudo", "email", "firstName", "birth", "password"];
+ var updateProfil = ["username", "email", "firstName", "birth", "password"];
var updateOk = true;
for (var i=0; i 0){
document.getElementById("displayUser").textContent=user;
}
@@ -68,7 +68,7 @@ document.getElementById("addUser").addEventListener("click", function(){
console.log(error);
switch(error.response.status){
case 401:
- listExist = [ "pseudo", "email" ];
+ listExist = [ "username", "email" ];
for(var i=0; i 0){
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(search)){
param = param + "email="+search+"&";
- } else if(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(search)){
- param = param + "uuid="+search+"&";
} else {
- param = param + "search="+search+"&";
+ param = param + "id="+search+"&";
}
} else {
- listParam.push("email"); listParam.push("uuid"); listParam.push("search");
+ listParam.push("email"); listParam.push("id");
}
for (var i=0; i 0) || (pseudo.value.length > 0)){
- instance.get("token", { auth : {username: pseudo.value, password: password.value}, withCredentials: true})
- .then(function(response) { location.href="html/users.html"; })
+ authData = {username: pseudo.value, password: password.value}
+ instance.post("token", {username: pseudo.value, password: password.value}, {headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' }})
+ .then(function(response) {
+ if(response.data["roles"] == "Admin"){
+ location.href="html/users.html";
+ }
+ else {
+ instance.delete("token")
+ }
+ })
.catch(function(error){
switch (error.response.status){
diff --git a/web/js/user.js b/web/js/user.js
index 842268e..c80838e 100644
--- a/web/js/user.js
+++ b/web/js/user.js
@@ -6,7 +6,7 @@ var id = getQuery("id");
if(id.length > 0){
instance.get("users/"+id, {withCredentials: true})
.then(function(response){
- var listValue = [ "id", "pseudo", "name", "firstName", "email", "birth"];
+ var listValue = [ "id", "username", "name", "firstName", "email", "birth"];
var listTime = ["connected_at", "created_at", "updated_at", "deleted_at"];
for (var i=0; i 0){
switch(e.currentTarget.id){
case "disableUserButton":
httpMethod = "delete";
- httpUrl = "users/disable/"+idInput;
+ httpUrl = "users/"+idInput;
break;
case "removeUserButton":
httpMethod = "delete";
- httpUrl = "users/"+idInput;
+ httpUrl = "users/"+idInput+"?remove=true";
break;
default:
httpMethod = "patch";
- httpUrl = "users/enable/"+idInput;
+ httpUrl = "users/"+idInput;
break;
}
instance({
@@ -101,7 +101,7 @@ if(id.length > 0){
document.getElementById("updateUserButton").addEventListener("click", function(){
- var updateProfil = ["id", "pseudo", "email", "firstName", "birth"];
+ var updateProfil = ["id", "username", "email", "firstName", "birth"];
var updateOk = true;
for (var i=0; i 0){
}
dataPut = {
-
- "id": id,
- "pseudo": document.getElementById("pseudoUpdateInput").value,
+ "id": document.getElementById("idUpdateInput").value,
+ "username": document.getElementById("usernameUpdateInput").value,
"email": document.getElementById("emailUpdateInput").value,
"name": document.getElementById("nameUpdateInput").value,
"firstName": document.getElementById("firstNameUpdateInput").value,
@@ -139,8 +138,8 @@ if(id.length > 0){
}
instance({
- method : "patch",
- url:"users/"+id,
+ method : "put",
+ url:"users/"+document.getElementById("idUpdateInput").value,
withCredentials: true,
data: dataPut
}).then(function(response){
diff --git a/web/js/users.js b/web/js/users.js
index 7d530a9..50302e3 100644
--- a/web/js/users.js
+++ b/web/js/users.js
@@ -2,7 +2,7 @@ checkToken();
signOut();
var param = {}
-param["nbPages"] = 20;
+param["limit"] = 20;
var listSearch = [ "email", "uuid", "search"];
for(var i=0; i 1){
document.getElementById("page").classList.remove("hidden");
- var pageCurrent = getQuery("page");
+ var pageCurrent = getQuery("skip");
var page = 1;
if(pageCurrent.length > 0){
page = Number.parseInt(pageCurrent);
@@ -68,14 +68,14 @@ instance.get("users/count", { withCredentials: true }).then(function(response){
});
-param["page"] = 0;
-var pageCurrent = getQuery("page");
+param["skip"] = 0;
+var pageCurrent = getQuery("skip");
if (pageCurrent.length > 0){
- param["page"] = Number.parseInt(pageCurrent);
- param["page"] = param["page"] - 1;
+ param["skip"] = Number.parseInt(pageCurrent);
+ param["skip"] = param["skip"] - 1;
}
-var listQuery = ["search", "uuid", "roles", "status", "email"];
+var listQuery = ["search", "id", "roles", "status", "email"];
for (var i=0; i 0){
@@ -83,12 +83,64 @@ for (var i=0; i 0 ){
+ var listModalButton = ["disable", "enable", "remove"];
+
+ for (var i=0; i 0){
+ userids.push(userid);
+ }
+ }
+ }
+
+ param["ids"]=userids;
+
+ switch(e.currentTarget.id){
+ case "disableUserButton":
+ httpMethod = "delete";
+ httpUrl = "users/groups";
+ break;
+ case "removeUserButton":
+ httpMethod = "delete";
+ httpUrl = "users/groups?remove=true";
+ break;
+ default:
+ httpMethod = "patch";
+ httpUrl = "users/groups";
+ break;
+ }
+ instance({
+ method: httpMethod,
+ url: httpUrl,
+ data:param,
+ withCredentials: true
+ })
+ .then(function(response){
+ if(response.status == 200){
+ location.href="/html/users.html";
+ }
+ })
+ .catch(function(error){
+ console.log(error);
+ });
+ });
+ }
+ }
for (var i=0; i