Add authentication mecanisme and secure database.

This commit is contained in:
2020-09-26 20:48:29 +02:00
parent 54495c0689
commit 8a4463cbc5
14 changed files with 93 additions and 43 deletions

View File

@@ -8,10 +8,12 @@ router.post('/login', (request, response) => {
if (!loginRequest) {
response.status(403).send();
} else {
userService.checkCredentials(loginRequest.login, loginRequest.password, () => {
const tokenPayload = { login: loginRequest.login };
response.json(tokenService.build(tokenPayload));
}, () => response.status(403).send());
userService.checkCredentials(loginRequest.login, loginRequest.password,
() => {
const tokenPayload = { login: loginRequest.login };
response.json(tokenService.build(tokenPayload));
},
() => response.status(403).send());
}
});