[Fixed] Rearranged username/names fields' types (allow utf-8 + spaces)
This commit is contained in:
parent
7b4cdbc20f
commit
b1ca22d9b5
|
@ -96,15 +96,11 @@
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'alphanumeric':
|
case 'alphanumeric':
|
||||||
return $checker && is_string($value) && preg_match('/^[\w\.-]+$/ui', $value);
|
return $checker && is_string($value) && preg_match('/^[\w\.-]*$/ui', $value);
|
||||||
break;
|
|
||||||
|
|
||||||
case 'lettersutf8':
|
|
||||||
return $checker && is_string($value) && preg_match('/^[^\W\d]+$/ui', $value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'letters':
|
case 'letters':
|
||||||
return $checker && is_string($value) && preg_match('/^[a-z -]+$/i', $value);
|
return $checker && is_string($value) && preg_match('/^\w[\w\. -]*$/ui', $value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'status':
|
case 'status':
|
||||||
|
|
|
@ -92,8 +92,8 @@
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid" },
|
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid" },
|
||||||
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)" },
|
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)" },
|
||||||
"firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,lettersutf8)" },
|
"firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,letters)" },
|
||||||
"lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,lettersutf8)" },
|
"lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,letters)" },
|
||||||
"mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail" }
|
"mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail" }
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
|
@ -193,8 +193,8 @@
|
||||||
"id_user": { "description": "UID de l'utilisateur.", "type": "id" },
|
"id_user": { "description": "UID de l'utilisateur.", "type": "id" },
|
||||||
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid", "optional": true },
|
"code": { "description": "Code RFID de l'utilisateur.", "type": "rfid", "optional": true },
|
||||||
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)", "optional": true },
|
"username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)", "optional": true },
|
||||||
"firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,lettersutf8)", "optional": true },
|
"firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,letters)", "optional": true },
|
||||||
"lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,lettersutf8)", "optional": true },
|
"lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,letters)", "optional": true },
|
||||||
"mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail", "optional": true },
|
"mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail", "optional": true },
|
||||||
"password": { "description": "Mot de passe de l'utilisateur.", "type": "text", "optional": true },
|
"password": { "description": "Mot de passe de l'utilisateur.", "type": "text", "optional": true },
|
||||||
"status": { "description": "Status de l'utilisateur.", "type": "status", "optional": true }
|
"status": { "description": "Status de l'utilisateur.", "type": "status", "optional": true }
|
||||||
|
@ -249,7 +249,7 @@
|
||||||
"description": "Création d'une nouvelle machine.",
|
"description": "Création d'une nouvelle machine.",
|
||||||
"permissions": ["warehouse", "admin"],
|
"permissions": ["warehouse", "admin"],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"name": { "description": "Nom de la machine.", "type": "varchar(1,30,alphanumeric)" }
|
"name": { "description": "Nom de la machine.", "type": "varchar(1,30,letters)" }
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
"id_machine": { "description": "UID de la machine.", "type": "id" }
|
"id_machine": { "description": "UID de la machine.", "type": "id" }
|
||||||
|
@ -311,7 +311,7 @@
|
||||||
"description": "Retourne les données d'une machine de nom donné.",
|
"description": "Retourne les données d'une machine de nom donné.",
|
||||||
"permissions": ["warehouse", "admin"],
|
"permissions": ["warehouse", "admin"],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"name": { "description": "Nom de la machine.", "type": "varchar(1,30,alphanumeric)" }
|
"name": { "description": "Nom de la machine.", "type": "varchar(1,30,letters)" }
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
"machine": { "description": "Données de la machine.", "type": "array<mixed>" }
|
"machine": { "description": "Données de la machine.", "type": "array<mixed>" }
|
||||||
|
@ -334,7 +334,7 @@
|
||||||
"permissions": ["warehouse", "admin"],
|
"permissions": ["warehouse", "admin"],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"id_machine": { "description": "UID de la machine.", "type": "id" },
|
"id_machine": { "description": "UID de la machine.", "type": "id" },
|
||||||
"name": { "description": "Nom de la machine.", "type": "varchar(1,30,alphanumeric)", "optional": true }
|
"name": { "description": "Nom de la machine.", "type": "varchar(1,30,letters)", "optional": true }
|
||||||
},
|
},
|
||||||
"output": {}
|
"output": {}
|
||||||
},
|
},
|
||||||
|
@ -359,7 +359,7 @@
|
||||||
"description": "Création d'un nouveau groupe.",
|
"description": "Création d'un nouveau groupe.",
|
||||||
"permissions": ["warehouse", "admin"],
|
"permissions": ["warehouse", "admin"],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"name": { "description": "Nom du groupe.", "type": "varchar(1,30,alphanumeric)" },
|
"name": { "description": "Nom du groupe.", "type": "varchar(1,30,letters)" },
|
||||||
"class": { "description": "Type de groupe.", "type": "id" }
|
"class": { "description": "Type de groupe.", "type": "id" }
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
|
@ -406,7 +406,7 @@
|
||||||
"description": "Retourne un groupe de nom donné.",
|
"description": "Retourne un groupe de nom donné.",
|
||||||
"permissions": ["warehouse", "admin"],
|
"permissions": ["warehouse", "admin"],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"name": { "description": "Nom du groupe.", "type": "varchar(1,30,alphanumeric)" },
|
"name": { "description": "Nom du groupe.", "type": "varchar(1,30,letters)" },
|
||||||
"class": { "description": "Type de groupe.", "type": "id" }
|
"class": { "description": "Type de groupe.", "type": "id" }
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
|
@ -432,7 +432,7 @@
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"id_cluster": { "description": "UID du groupe.", "type": "id" },
|
"id_cluster": { "description": "UID du groupe.", "type": "id" },
|
||||||
"class": { "description": "Type de groupe.", "type": "id" },
|
"class": { "description": "Type de groupe.", "type": "id" },
|
||||||
"name": { "description": "Nom du groupe.", "type": "varchar(1,30,alphanumeric)" }
|
"name": { "description": "Nom du groupe.", "type": "varchar(1,30,letters)" }
|
||||||
},
|
},
|
||||||
"output": {
|
"output": {
|
||||||
"status": { "description": "Status de la modification.", "type": "boolean" }
|
"status": { "description": "Status de la modification.", "type": "boolean" }
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
// logout from admin
|
// logout from admin
|
||||||
$R->get('logout/?', function(){
|
$R->get('logout/?', function(){
|
||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$req = new Request('authentificationDefault/admin', ['username' => '0', 'password' => '']);
|
$req = new Request('authentificationDefault/admin', ['username' => ' ', 'password' => '']);
|
||||||
$res = $req->dispatch();
|
$res = $req->dispatch();
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
});
|
});
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
// warehouse logout
|
// warehouse logout
|
||||||
$R->get('logout/?', function(){
|
$R->get('logout/?', function(){
|
||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
(new Request('authentificationDefault/warehouse', ['name' => '000', 'password' => '']))->dispatch();
|
(new Request('authentificationDefault/warehouse', ['name' => ' ', 'password' => '']))->dispatch();
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue