Pagina "Attività" non compare bene la scritta Beni e Servizi... ?!
This commit is contained in:
@@ -1204,6 +1204,8 @@ UserSchema.statics.createNewRequestPwd = function (idapp, email, code) {
|
|||||||
|
|
||||||
const sendemail = require('../sendemail');
|
const sendemail = require('../sendemail');
|
||||||
|
|
||||||
|
console.log('createNewRequestPwd');
|
||||||
|
|
||||||
if (code && code.length === 6) {
|
if (code && code.length === 6) {
|
||||||
return User.findByLinkTokenforgotCode(idapp, email, code)
|
return User.findByLinkTokenforgotCode(idapp, email, code)
|
||||||
.then((user) => {
|
.then((user) => {
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ router.post(process.env.LINK_REQUEST_NEWPASSWORD, async (req, res) => {
|
|||||||
const email = body.email.toLowerCase().trim();
|
const email = body.email.toLowerCase().trim();
|
||||||
const codetocheck = body.codetocheck ? body.codetocheck.trim() : '';
|
const codetocheck = body.codetocheck ? body.codetocheck.trim() : '';
|
||||||
|
|
||||||
|
console.log('Request Reset Pwd:', email, ' idapp=', idapp);
|
||||||
|
|
||||||
// Check if too many requests
|
// Check if too many requests
|
||||||
if (await User.tooManyReqPassword(idapp, email, true)) {
|
if (await User.tooManyReqPassword(idapp, email, true)) {
|
||||||
console.log(process.env.LINK_REQUEST_NEWPASSWORD, 'TOO MANY REQUESTS !!! EXIT ', email);
|
console.log(process.env.LINK_REQUEST_NEWPASSWORD, 'TOO MANY REQUESTS !!! EXIT ', email);
|
||||||
|
|||||||
@@ -5,23 +5,23 @@ const tools = require('../tools/general');
|
|||||||
|
|
||||||
const server_constants = require('../tools/server_constants');
|
const server_constants = require('../tools/server_constants');
|
||||||
|
|
||||||
const {authenticate} = require('../middleware/authenticate');
|
const { authenticate } = require('../middleware/authenticate');
|
||||||
|
|
||||||
const mongoose = require('mongoose').set('debug', false);
|
const mongoose = require('mongoose').set('debug', false);
|
||||||
|
|
||||||
const {User} = require('../models/user');
|
const { User } = require('../models/user');
|
||||||
const {MyGroup} = require('../models/mygroup');
|
const { MyGroup } = require('../models/mygroup');
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
const {ObjectID} = require('mongodb');
|
const { ObjectID } = require('mongodb');
|
||||||
|
|
||||||
async function getGroupRecAdminsInfo(idapp, data) {
|
async function getGroupRecAdminsInfo(idapp, data) {
|
||||||
|
|
||||||
if (data && data.admins) {
|
if (data && data.admins) {
|
||||||
for (const admin of data.admins) {
|
for (const admin of data.admins) {
|
||||||
const myuser = await User.findOne({idapp, username: admin.username}, {'profile.img': 1}).lean();
|
const myuser = await User.findOne({ idapp, username: admin.username }, { 'profile.img': 1 }).lean();
|
||||||
admin.profile = {img: myuser.profile.img};
|
admin.profile = { img: myuser.profile.img };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,14 +35,33 @@ router.post('/load', authenticate, async (req, res) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const {SendNotif} = require('../models/sendnotif');
|
const { SendNotif } = require('../models/sendnotif');
|
||||||
|
const { Circuit } = require('../models/circuit');
|
||||||
|
const { Account } = require('../models/account');
|
||||||
|
|
||||||
// Check if ìs a Notif to read
|
// Check if ìs a Notif to read
|
||||||
const idnotif = req.body['idnotif'] ? req.body['idnotif'] : '';
|
const idnotif = req.body['idnotif'] ? req.body['idnotif'] : '';
|
||||||
SendNotif.setNotifAsRead(idapp, usernameOrig, idnotif);
|
SendNotif.setNotifAsRead(idapp, usernameOrig, idnotif);
|
||||||
|
|
||||||
const whatshow = MyGroup.getWhatToShow(idapp, req.user.username);
|
const whatshow = MyGroup.getWhatToShow(idapp, req.user.username);
|
||||||
let data = await MyGroup.findOne({idapp, groupname}, whatshow).lean();
|
let data = await MyGroup.findOne({ idapp, groupname }, whatshow).lean();
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (data.mycircuits) {
|
||||||
|
for (let i = 0; i < data.mycircuits.length; i++) {
|
||||||
|
const mycirc = await Circuit.findOne({ idapp, name: data.mycircuits[i].circuitname }).lean();
|
||||||
|
data.mycircuits[i] = mycirc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (data.mycircuits) {
|
||||||
|
for (let i = 0; i < data.mycircuits.length; i++) {
|
||||||
|
const mycirc = await Circuit.findOne({ idapp, name: data.mycircuits[i].circuitname }).lean();
|
||||||
|
if (mycirc)
|
||||||
|
data.mycircuits[i].account = await Account.getAccountByUsernameAndCircuitId(idapp, '', mycirc._id, true, groupname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let cities = [];
|
let cities = [];
|
||||||
if (data) {
|
if (data) {
|
||||||
@@ -60,13 +79,13 @@ router.post('/load', authenticate, async (req, res) => {
|
|||||||
{
|
{
|
||||||
idapp,
|
idapp,
|
||||||
'profile.mygroups': {
|
'profile.mygroups': {
|
||||||
$elemMatch: {groupname: {$eq: groupname}},
|
$elemMatch: { groupname: { $eq: groupname } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
whatshowUsers,
|
whatshowUsers,
|
||||||
).lean();
|
).lean();
|
||||||
|
|
||||||
res.send({mygroup: data, users_in_group, cities});
|
res.send({ mygroup: data, users_in_group, cities });
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error in MyGroups', e);
|
console.error('Error in MyGroups', e);
|
||||||
|
|||||||
@@ -279,6 +279,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
sendEmail_RequestNewPassword: async function(lang, user, emailto, idapp, tokenforgot, tokenforgot_code) {
|
sendEmail_RequestNewPassword: async function(lang, user, emailto, idapp, tokenforgot, tokenforgot_code) {
|
||||||
|
console.log('sendEmail_RequestNewPassword');
|
||||||
|
|
||||||
let mylocalsconf = {
|
let mylocalsconf = {
|
||||||
idapp,
|
idapp,
|
||||||
|
|||||||
Reference in New Issue
Block a user