Commit e5b4691f by Denys Tito Urbano

Router auth modificado (Login solo con email)

parent 0c7f0619
const connection = require('./config'); const connection = require('./config');
const post_login = async ({ email, password }) => { const post_login = async ({ email, password }) => {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_login ( $1, $2 );', [email, password]); if (password) {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_login ( $1, $2 );', [email, password]);
} else {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_login ( $1 );', [email]);
}
}; };
const get_account = async ({ documento }) => { const get_account = async ({ documento }) => {
......
...@@ -6,7 +6,7 @@ const { validate_errors, validate_jwt } = require('../middlewares'); ...@@ -6,7 +6,7 @@ const { validate_errors, validate_jwt } = require('../middlewares');
router.post('/login', router.post('/login',
check('email', 'Usuario inválido').not().isEmpty(), check('email', 'Usuario inválido').not().isEmpty(),
check('password', 'Contraseña inválida').not().isEmpty(), //check('password', 'Contraseña inválida').not().isEmpty(),
validate_errors, validate_errors,
post_login); post_login);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment