diff --git a/backend/src/app.js b/backend/src/app.js
index 51311d1..63a4375 100644
--- a/backend/src/app.js
+++ b/backend/src/app.js
@@ -1,5 +1,5 @@
// Load the express module to create a web application
-
+// const path = require("path");
const express = require("express");
const app = express();
diff --git a/backend/src/controllers/authControllers.js b/backend/src/controllers/authControllers.js
index b54d1ae..ac7d2b0 100644
--- a/backend/src/controllers/authControllers.js
+++ b/backend/src/controllers/authControllers.js
@@ -1,4 +1,4 @@
-const { hash, argon2 } = require("argon2");
+const { hash, verify, argon2id } = require("argon2");
const jwt = require("jsonwebtoken");
// Import access to database tables
const tables = require("../tables");
@@ -9,7 +9,7 @@ const add = (req, res) => {
// We create our hashing options
const hashingOptions = {
- type: argon2.argon2id,
+ type: argon2id,
memoryCost: 2 ** 16,
timeCost: 5,
parallelism: 1,
@@ -45,10 +45,7 @@ const login = async (req, res, next) => {
return;
}
- const verified = await argon2.verify(
- user.hashed_password,
- req.body.password
- );
+ const verified = await verify(user.hashed_password, req.body.password);
if (verified) {
// Respond with the user in JSON format (but without the hashed password)
diff --git a/backend/src/router.js b/backend/src/router.js
index a941814..694f040 100644
--- a/backend/src/router.js
+++ b/backend/src/router.js
@@ -3,11 +3,11 @@ const express = require("express");
const router = express.Router();
const authControllers = require("./controllers/authControllers");
-const { checkDatas } = require("./services/validateLogin");
+// const { checkDatas } = require("./services/validateLogin");
const userControllers = require("./controllers/userControllers");
const { validateUser } = require("./services/validateUser");
-const { verifyToken, hashPassword } = require("./services/auth");
+const { hashPassword } = require("./services/auth");
const artworksControllers = require("./controllers/artworkControllers");
const { validateArtwork } = require("./services/validateArtwork");
@@ -24,7 +24,7 @@ const { validateCapture } = require("./services/validateCapture");
// Authentification routes
router.post("/register", authControllers.add);
-router.post("/login", checkDatas, verifyToken, authControllers.login);
+router.post("/login", authControllers.login);
// Routes of users
router.get("/users", userControllers.browse);
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index cb8014f..1efdc85 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -7,11 +7,14 @@
"dependencies": {
"@react-hook/media-query": "^1.1.1",
"axios": "^1.6.5",
+ "jwt-decode": "^4.0.0",
"leaflet": "^1.9.4",
"leaflet.locatecontrol": "^0.79.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-dropzone": "^14.2.3",
+ "react-html5-camera-photo": "^1.5.11",
"react-leaflet": "^4.2.1",
"react-router-dom": "^6.14.2",
"sass": "^1.69.7"
@@ -1274,6 +1277,14 @@
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
+ "node_modules/attr-accept": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-2.2.2.tgz",
+ "integrity": "sha512-7prDjvt9HmqiZ0cl5CRjtS84sEyhsHP2coDkaZKRKVfCDo9s7iw7ChVmar78Gu9pC4SoR/28wFu/G5JJhTnqEg==",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/available-typed-arrays": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
@@ -2501,6 +2512,17 @@
"node": "^10.12.0 || >=12.0.0"
}
},
+ "node_modules/file-selector": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.6.0.tgz",
+ "integrity": "sha512-QlZ5yJC0VxHxQQsQhXvBaC7VRJ2uaxTf+Tfpu4Z/OcVQJVpZO+DGU0rkoVW5ce2SccxugvpBJoMvUs59iILYdw==",
+ "dependencies": {
+ "tslib": "^2.4.0"
+ },
+ "engines": {
+ "node": ">= 12"
+ }
+ },
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -3377,6 +3399,11 @@
"node": ">=4"
}
},
+ "node_modules/jslib-html5-camera-photo": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/jslib-html5-camera-photo/-/jslib-html5-camera-photo-3.3.4.tgz",
+ "integrity": "sha512-qysjLnP4bud0+g0qs5uA/7i569x+6ID2ufgezf9XQ+BE3EvhYjz177vi9WXLEuq+V6C/WXEv73NUICvHm5VGmQ=="
+ },
"node_modules/json-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
@@ -3422,6 +3449,14 @@
"node": ">=4.0"
}
},
+ "node_modules/jwt-decode": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz",
+ "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/keyv": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
@@ -4063,6 +4098,34 @@
"react": "^18.2.0"
}
},
+ "node_modules/react-dropzone": {
+ "version": "14.2.3",
+ "resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-14.2.3.tgz",
+ "integrity": "sha512-O3om8I+PkFKbxCukfIR3QAGftYXDZfOE2N1mr/7qebQJHs7U+/RSL/9xomJNpRg9kM5h9soQSdf0Gc7OHF5Fug==",
+ "dependencies": {
+ "attr-accept": "^2.2.2",
+ "file-selector": "^0.6.0",
+ "prop-types": "^15.8.1"
+ },
+ "engines": {
+ "node": ">= 10.13"
+ },
+ "peerDependencies": {
+ "react": ">= 16.8 || 18.0.0"
+ }
+ },
+ "node_modules/react-html5-camera-photo": {
+ "version": "1.5.11",
+ "resolved": "https://registry.npmjs.org/react-html5-camera-photo/-/react-html5-camera-photo-1.5.11.tgz",
+ "integrity": "sha512-5OpdW66UmwKwd0ZHvy/U9tEZj19GrcG6RDRXjs1bFBgJoWzLJoJ7YNd8rmdrizV/6go/z9GrwoWMovqCUyaJgQ==",
+ "dependencies": {
+ "jslib-html5-camera-photo": "3.3.4"
+ },
+ "peerDependencies": {
+ "react": ">=16.8.0",
+ "react-dom": ">=16.8.0"
+ }
+ },
"node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@@ -4726,8 +4789,7 @@
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
- "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
- "dev": true
+ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"node_modules/type-check": {
"version": "0.4.0",
@@ -5877,6 +5939,11 @@
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
+ "attr-accept": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-2.2.2.tgz",
+ "integrity": "sha512-7prDjvt9HmqiZ0cl5CRjtS84sEyhsHP2coDkaZKRKVfCDo9s7iw7ChVmar78Gu9pC4SoR/28wFu/G5JJhTnqEg=="
+ },
"available-typed-arrays": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
@@ -6785,6 +6852,14 @@
"flat-cache": "^3.0.4"
}
},
+ "file-selector": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.6.0.tgz",
+ "integrity": "sha512-QlZ5yJC0VxHxQQsQhXvBaC7VRJ2uaxTf+Tfpu4Z/OcVQJVpZO+DGU0rkoVW5ce2SccxugvpBJoMvUs59iILYdw==",
+ "requires": {
+ "tslib": "^2.4.0"
+ }
+ },
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -7372,6 +7447,11 @@
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
"dev": true
},
+ "jslib-html5-camera-photo": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/jslib-html5-camera-photo/-/jslib-html5-camera-photo-3.3.4.tgz",
+ "integrity": "sha512-qysjLnP4bud0+g0qs5uA/7i569x+6ID2ufgezf9XQ+BE3EvhYjz177vi9WXLEuq+V6C/WXEv73NUICvHm5VGmQ=="
+ },
"json-buffer": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
@@ -7408,6 +7488,11 @@
"object.values": "^1.1.6"
}
},
+ "jwt-decode": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz",
+ "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA=="
+ },
"keyv": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
@@ -7852,6 +7937,24 @@
"scheduler": "^0.23.0"
}
},
+ "react-dropzone": {
+ "version": "14.2.3",
+ "resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-14.2.3.tgz",
+ "integrity": "sha512-O3om8I+PkFKbxCukfIR3QAGftYXDZfOE2N1mr/7qebQJHs7U+/RSL/9xomJNpRg9kM5h9soQSdf0Gc7OHF5Fug==",
+ "requires": {
+ "attr-accept": "^2.2.2",
+ "file-selector": "^0.6.0",
+ "prop-types": "^15.8.1"
+ }
+ },
+ "react-html5-camera-photo": {
+ "version": "1.5.11",
+ "resolved": "https://registry.npmjs.org/react-html5-camera-photo/-/react-html5-camera-photo-1.5.11.tgz",
+ "integrity": "sha512-5OpdW66UmwKwd0ZHvy/U9tEZj19GrcG6RDRXjs1bFBgJoWzLJoJ7YNd8rmdrizV/6go/z9GrwoWMovqCUyaJgQ==",
+ "requires": {
+ "jslib-html5-camera-photo": "3.3.4"
+ }
+ },
"react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@@ -8308,8 +8411,7 @@
"tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
- "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
- "dev": true
+ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"type-check": {
"version": "0.4.0",
diff --git a/frontend/package.json b/frontend/package.json
index 47ff050..6c9ffd4 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -7,11 +7,14 @@
"dependencies": {
"@react-hook/media-query": "^1.1.1",
"axios": "^1.6.5",
+ "jwt-decode": "^4.0.0",
"leaflet": "^1.9.4",
"leaflet.locatecontrol": "^0.79.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-dropzone": "^14.2.3",
+ "react-html5-camera-photo": "^1.5.11",
"react-leaflet": "^4.2.1",
"react-router-dom": "^6.14.2",
"sass": "^1.69.7"
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 959e216..51ae67a 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -1,8 +1,8 @@
-import Home from "./pages/Home";
+import { Outlet } from "react-router-dom";
import "./styles/commons.scss";
function App() {
- return
Envoyer ma photo
+Logo de Téléchargement
-Télécharger ma photo
- +