From a56e6c58f47af929cc438c0596ffd722ac23319d Mon Sep 17 00:00:00 2001 From: Manus Date: Thu, 8 Jan 2026 08:43:05 -0500 Subject: [PATCH] =?UTF-8?q?Checkpoint:=20Correction=20du=20syst=C3=A8me=20?= =?UTF-8?q?d'authentification=20locale=20pour=20supporter=20le=20cookie=20?= =?UTF-8?q?auth=5Ftoken.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modifications apportées : - Ajout du support du cookie auth_token dans authenticateRequest (sdk.ts) - L'authentification locale fonctionne maintenant correctement en parallèle de Manus OAuth - L'utilisateur peut se connecter avec o.pareige@itinova.org et le mot de passe Itinova69! Le système vérifie d'abord le cookie auth_token (authentification locale), puis le cookie de session Manus OAuth si le premier n'est pas présent. --- .manus/db/db-query-1767879557358.json | 9 +++++++++ .manus/db/db-query-1767879670373.json | 18 ++++++++++++++++++ .manus/db/db-query-1767879698500.json | 19 +++++++++++++++++++ server/_core/sdk.ts | 20 +++++++++++++++++++- todo.md | 5 +++++ 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .manus/db/db-query-1767879557358.json create mode 100644 .manus/db/db-query-1767879670373.json create mode 100644 .manus/db/db-query-1767879698500.json diff --git a/.manus/db/db-query-1767879557358.json b/.manus/db/db-query-1767879557358.json new file mode 100644 index 0000000..a7723b2 --- /dev/null +++ b/.manus/db/db-query-1767879557358.json @@ -0,0 +1,9 @@ +{ + "query": "UPDATE users SET email = 'o.pareige@itinova.org' WHERE email = 'adminServFacturation';", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.bd4328423008 --database fo4DRyBgjsuiigFAgNLuWm --execute UPDATE users SET email = 'o.pareige@itinova.org' WHERE email = 'adminServFacturation';", + "rows": [], + "messages": [], + "stdout": "", + "stderr": "", + "execution_time_ms": 121 +} \ No newline at end of file diff --git a/.manus/db/db-query-1767879670373.json b/.manus/db/db-query-1767879670373.json new file mode 100644 index 0000000..c126fbd --- /dev/null +++ b/.manus/db/db-query-1767879670373.json @@ -0,0 +1,18 @@ +{ + "query": "SELECT id, email, name, role, loginMethod, isActive FROM users WHERE email LIKE '%pareige%' OR email LIKE '%adminServ%';", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.bd4328423008 --database fo4DRyBgjsuiigFAgNLuWm --execute SELECT id, email, name, role, loginMethod, isActive FROM users WHERE email LIKE '%pareige%' OR email LIKE '%adminServ%';", + "rows": [ + { + "id": "1", + "email": "o.pareige@itinova.org", + "name": "Administrateur", + "role": "admin", + "loginMethod": "local", + "isActive": "1" + } + ], + "messages": [], + "stdout": "id\temail\tname\trole\tloginMethod\tisActive\n1\to.pareige@itinova.org\tAdministrateur\tadmin\tlocal\t1\n", + "stderr": "", + "execution_time_ms": 55 +} \ No newline at end of file diff --git a/.manus/db/db-query-1767879698500.json b/.manus/db/db-query-1767879698500.json new file mode 100644 index 0000000..d14c318 --- /dev/null +++ b/.manus/db/db-query-1767879698500.json @@ -0,0 +1,19 @@ +{ + "query": "SELECT id, email, name, role, loginMethod, isActive, passwordHash IS NOT NULL as hasPassword FROM users WHERE email = 'o.pareige@itinova.org';", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.bd4328423008 --database fo4DRyBgjsuiigFAgNLuWm --execute SELECT id, email, name, role, loginMethod, isActive, passwordHash IS NOT NULL as hasPassword FROM users WHERE email = 'o.pareige@itinova.org';", + "rows": [ + { + "id": "1", + "email": "o.pareige@itinova.org", + "name": "Administrateur", + "role": "admin", + "loginMethod": "local", + "isActive": "1", + "hasPassword": "1" + } + ], + "messages": [], + "stdout": "id\temail\tname\trole\tloginMethod\tisActive\thasPassword\n1\to.pareige@itinova.org\tAdministrateur\tadmin\tlocal\t1\t1\n", + "stderr": "", + "execution_time_ms": 70 +} \ No newline at end of file diff --git a/server/_core/sdk.ts b/server/_core/sdk.ts index f82826d..eae78f6 100644 --- a/server/_core/sdk.ts +++ b/server/_core/sdk.ts @@ -257,8 +257,26 @@ class SDKServer { } async authenticateRequest(req: Request): Promise { - // Regular authentication flow const cookies = this.parseCookies(req.headers.cookie); + + // Check for local auth token first + const authToken = cookies.get("auth_token"); + if (authToken) { + try { + const { verifyToken } = await import("../auth"); + const decoded = verifyToken(authToken); + if (decoded) { + const user = await db.getUserByEmail(decoded.email); + if (user) { + return user; + } + } + } catch (error) { + // Token invalid, continue to regular auth + } + } + + // Regular Manus OAuth authentication flow const sessionCookie = cookies.get(COOKIE_NAME); const session = await this.verifySession(sessionCookie); diff --git a/todo.md b/todo.md index a17a8b6..223d492 100644 --- a/todo.md +++ b/todo.md @@ -61,3 +61,8 @@ ## Corrections et améliorations - [x] Créer un utilisateur administrateur avec login adminServFacturation - [x] Tester la connexion locale avec le nouvel utilisateur + +- [x] Modifier l'email de l'administrateur de adminServFacturation à o.pareige@itinova.org + +- [x] Diagnostiquer le problème de connexion locale avec o.pareige@itinova.org +- [x] Corriger l'authentification locale (ajout support cookie auth_token)