- fix scelta provincia (il bottone Avanti non veniva disabilitato).

- Se non scelgo la provincia, non deve farmi vedere la App...
This commit is contained in:
Surya Paolo
2024-03-28 20:25:48 +01:00
parent de13c42f8b
commit 970428a359
10 changed files with 3592560 additions and 17 deletions

View File

@@ -186,7 +186,7 @@ router.post(process.env.LINK_REQUEST_NEWPASSWORD, async (req, res) => {
// Check if too many requests
if (await User.tooManyReqPassword(idapp, email, true)) {
let text = 'Troppe richieste di Password: ' + email;
telegrambot.sendMsgTelegramToTheManagers(idapp, text, true);
telegrambot.sendMsgTelegramToTheManagers(idapp, text);
console.log(process.env.LINK_REQUEST_NEWPASSWORD, text, email);
res.status(400).send({ code: server_constants.RIS_CODE_ERR, msg: text });
return false;
@@ -854,12 +854,12 @@ router.patch('/chval', authenticate, async (req, res) => {
// If I change my record...
if ((
(!User.isAdmin(req.user.perm)
&& !User.isManager(req.user.perm)
&& !User.isEditor(req.user.perm)
&& !User.isFacilitatore(req.user.perm))
&& !User.isManager(req.user.perm)
&& !User.isEditor(req.user.perm)
&& !User.isFacilitatore(req.user.perm))
&& (!tools.ModificheConsentite(req, mydata.table, fieldsvalue, id)))
&& !((mydata.table === 'accounts')
&& await Account.canEditAccountAdmins(req.user.username, mydata.id))
&& !((mydata.table === 'accounts')
&& await Account.canEditAccountAdmins(req.user.username, mydata.id))
) {
// If without permissions, exit
return res.status(404).
@@ -1232,7 +1232,7 @@ router.delete('/delrec/:table/:id', authenticate, async (req, res) => {
// let notifBot = false;
// const idapp = req.body.idapp;
console.log('id', id, 'table', tablename);
console.log('delete RECORD: id', id, 'table', tablename);
const mytable = globalTables.getTableByTableName(tablename);
@@ -1251,17 +1251,30 @@ router.delete('/delrec/:table/:id', authenticate, async (req, res) => {
//++Tools: Notify...
tools.NotifyIfDelRecord(tablename);
if (!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) {
// if (!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) {
if (true) {
if (tablename === 'users') {
let fieldsvalue = {
deleted: true,
date_deleted: new Date(),
};
const utente = await mytable.findById(id);
await mytable.findByIdAndUpdate(id, { $set: fieldsvalue });
if (utente) {
idapp = utente.idapp;
await mytable.findByIdAndUpdate(id, { $set: fieldsvalue });
// ...
let text = `L\'utente ${utente.username} (${utente.name} ${utente.surname}) si è cancellato dal sito ` + tools.getNomeAppByIdApp(utente.idapp) + ` Deleted = true`;
telegrambot.sendMsgTelegramToTheManagers(idapp, text);
}
cancellato = true;
return res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
}
}
@@ -1478,7 +1491,6 @@ function load(req, res, version) {
let site = Site.findAllIdApp(idapp);
let mygroups = MyGroup.findAllGroups(idapp);
let listcircuits = Circuit.findAllIdApp(idapp);
// let cities = City.findAllIdApp(idapp);
let provinces = Province.findAllIdApp(idapp);
let cart = null;
let orderscart = null;
@@ -1535,7 +1547,6 @@ function load(req, res, version) {
myuserextra, // 26
sectors, // 27
statusSkills, //28
// cities,
provinces,
catgrps,
adtypes,