add auth-service not verified with Dockerfile
This commit is contained in:
parent
3a7389ba68
commit
8cf6520224
12 changed files with 304 additions and 0 deletions
18
backend/service-authentication/checkLogin.js
Normal file
18
backend/service-authentication/checkLogin.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
const {sendError, sendMessage} = require ("./message");
|
||||
const auth = require ('./auth');
|
||||
|
||||
async function checkLogin (req,res) {
|
||||
if (typeof req.body.login === 'undefined')
|
||||
return sendError(res, 'Vous n\'avez pas envoyé le champ login');
|
||||
if (typeof req.body.password === 'undefined')
|
||||
return sendError(res, 'Vous n\'avez pas envoyé le champ password');
|
||||
|
||||
const result = await auth.authenticate(req, res);
|
||||
if (result){
|
||||
return sendMessage(res, result);
|
||||
}
|
||||
else{
|
||||
return sendError(res, 'Invalid username or password');
|
||||
}
|
||||
}
|
||||
module.exports = checkLogin;
|
||||
Reference in a new issue