- Downline User
- Not registered if already exists. - Forgot Password
This commit is contained in:
@@ -18,10 +18,21 @@ const { ObjectID } = require('mongodb');
|
||||
|
||||
router.post('/', authenticate, async (req, res) => {
|
||||
const idapp = req.body.idapp;
|
||||
let username = req.body.username;
|
||||
|
||||
const aportador_solidario = req.user.aportador_solidario;
|
||||
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) && (username) !== req.user.username) {
|
||||
// If without permissions, exit
|
||||
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
||||
}
|
||||
let aportador_solidario = req.user.aportador_solidario;
|
||||
|
||||
const dashboard = await User.getDashboard(idapp, aportador_solidario, req.user.username);
|
||||
if (username) {
|
||||
aportador_solidario = await User.getAportadorSolidarioByUsername(idapp, username)
|
||||
} else {
|
||||
username = req.user.username;
|
||||
}
|
||||
|
||||
const dashboard = await User.getDashboard(idapp, aportador_solidario, username);
|
||||
if (dashboard)
|
||||
res.send({ dashboard });
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user