This commit is contained in:
David Arranz 2019-08-28 19:09:10 +02:00
parent fc43cee157
commit 43d1da46ec
2 changed files with 6 additions and 4 deletions

View File

@ -103,6 +103,7 @@ async function register(req, res, next) {
//Comprobamos si el usuario ya existe en nuestro sistema
let newUser = await authService.extraMethods.findUser(values);
console.log('COMPROBAMOS IS EXISTE EN NUESTRO SISTEMA', newUser);
if (!newUser) {
try {
const data = {
@ -117,7 +118,7 @@ async function register(req, res, next) {
};
newUser = await authService.extraMethods.createUser(data);
console.log('CREAMOS EL USUARIO EN NUESTRO SISTEMA', newUser);
} catch (error) {
console.error(error);
return controllerHelper.handleErrorResponse(MODULE_NAME, register.name, error, res);
@ -137,6 +138,7 @@ async function register(req, res, next) {
const tokens = securityHelper.generateToken(tokenData);
newUser.token = tokens.token;
console.log('COMO YA EXISTE CREAMOS EL TOKEN Y LO ASIGNAMOS', newUser);
}
return controllerHelper.handleResultResponse(newUser, null, req.params, res, httpStatus.OK);

View File

@ -18,11 +18,11 @@ routes.post('/auth',
authController.login,
);
routes.get('/auth',
//routes.get('/auth',
// SchemaValidator(authValidation.LoginInputType, true),
// AccessValidator.isRegisteredUserEmail,
authController.login2,
);
// authController.login2,
//);
routes.get('/auth/verify',
AccessValidator.isAdministratorUser,