Pannello Utente

Aggiornamento Yarn
- Notifiche (1)
This commit is contained in:
Paolo Arena
2022-07-10 01:25:19 +02:00
parent c8324f0de4
commit ba99b72e69
10 changed files with 383 additions and 43 deletions

View File

@@ -403,6 +403,36 @@ router.post('/profile', authenticate, (req, res) => {
});
router.post('/panel', authenticate, async (req, res) => {
const username = req.body['username'];
idapp = req.body.idapp;
locale = req.body.locale;
if (!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) {
// If without permissions, exit
return res.status(404).
send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
}
try {
const myuser = await User.findOne({idapp, username},
{username: 1, email: 1, verified_by_aportador: 1, aportador_solidario: 1,
lasttimeonline: 1,
deleted: 1,
profile: 1}).lean();
if (!!myuser) {
res.send(myuser);
} else {
tools.mylog('ERRORE IN panel: ' + e.message);
res.status(400).send();
}
} catch (e) {
tools.mylogserr('Error profile: ', e);
res.status(400).send();
}
});
router.post('/login', (req, res) => {
var body = _.pick(req.body,
['username', 'password', 'idapp', 'keyappid', 'lang']);