a
This commit is contained in:
parent
fc43cee157
commit
43d1da46ec
@ -103,6 +103,7 @@ async function register(req, res, next) {
|
|||||||
|
|
||||||
//Comprobamos si el usuario ya existe en nuestro sistema
|
//Comprobamos si el usuario ya existe en nuestro sistema
|
||||||
let newUser = await authService.extraMethods.findUser(values);
|
let newUser = await authService.extraMethods.findUser(values);
|
||||||
|
console.log('COMPROBAMOS IS EXISTE EN NUESTRO SISTEMA', newUser);
|
||||||
if (!newUser) {
|
if (!newUser) {
|
||||||
try {
|
try {
|
||||||
const data = {
|
const data = {
|
||||||
@ -117,7 +118,7 @@ async function register(req, res, next) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
newUser = await authService.extraMethods.createUser(data);
|
newUser = await authService.extraMethods.createUser(data);
|
||||||
|
console.log('CREAMOS EL USUARIO EN NUESTRO SISTEMA', newUser);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return controllerHelper.handleErrorResponse(MODULE_NAME, register.name, error, res);
|
return controllerHelper.handleErrorResponse(MODULE_NAME, register.name, error, res);
|
||||||
@ -137,6 +138,7 @@ async function register(req, res, next) {
|
|||||||
const tokens = securityHelper.generateToken(tokenData);
|
const tokens = securityHelper.generateToken(tokenData);
|
||||||
|
|
||||||
newUser.token = tokens.token;
|
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);
|
return controllerHelper.handleResultResponse(newUser, null, req.params, res, httpStatus.OK);
|
||||||
|
|||||||
@ -18,11 +18,11 @@ routes.post('/auth',
|
|||||||
authController.login,
|
authController.login,
|
||||||
);
|
);
|
||||||
|
|
||||||
routes.get('/auth',
|
//routes.get('/auth',
|
||||||
// SchemaValidator(authValidation.LoginInputType, true),
|
// SchemaValidator(authValidation.LoginInputType, true),
|
||||||
// AccessValidator.isRegisteredUserEmail,
|
// AccessValidator.isRegisteredUserEmail,
|
||||||
authController.login2,
|
// authController.login2,
|
||||||
);
|
//);
|
||||||
|
|
||||||
routes.get('/auth/verify',
|
routes.get('/auth/verify',
|
||||||
AccessValidator.isAdministratorUser,
|
AccessValidator.isAdministratorUser,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user