Skip to content

Commit

Permalink
function Login
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanieh-Sadeghi committed Oct 22, 2023
1 parent 59541b0 commit 8aa9c96
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions server/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8aa9c96

Please sign in to comment.