From 8aa9c966f96e4c1be731b82e2d931342718a1956 Mon Sep 17 00:00:00 2001 From: Hanieh-Sadeghi Date: Mon, 23 Oct 2023 00:06:37 +0330 Subject: [PATCH] function Login --- server/controller.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/server/controller.js b/server/controller.js index 85e3828..c54c3b8 100644 --- a/server/controller.js +++ b/server/controller.js @@ -68,6 +68,27 @@ function signup(req, res) { }); } +function Login(req, res) { + db.forEach((user) => { + if ( + user.username === req.body.username && + user.password === req.body.password + ) { + const token = createToken(60); + user.token = "token"; + res.json({ + response: "login success", + token: token, + }); + } + }); +} + +function createToken() { + var result = '' ; + +} + module.exports = { getJson, postJson,