fix: Upload Foto

This commit is contained in:
paoloar77
2022-02-16 09:40:16 +01:00
parent a3502c1d9d
commit bae30504f7
9 changed files with 147 additions and 63 deletions

View File

@@ -361,7 +361,7 @@ router.post('/login', (req, res) => {
var user = new User(body);
// const subs = _.pick(req.body, ['subs']);
// tools.mylog("LOGIN: username: " + user.username + " pwd = " + user.password);
// tools.mylog("LOG: u: " + user.username + " p:" + user.password);
// tools.mylog("user REC:", user);
@@ -381,18 +381,11 @@ router.post('/login', (req, res) => {
tools.mylogshow(msg);
// telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
res.status(404).send({code: server_constants.RIS_CODE_LOGIN_ERR});
} else if (!!user.subaccount && user.subaccount) {
await tools.snooze(1000);
// const msg = "Tentativo di Login ERRATO [" + body.username + ' , ' + body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) + ']';
// tools.mylogshow(msg);
// telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
res.status(404).
send({code: server_constants.RIS_CODE_LOGIN_ERR_SUBACCOUNT});
return null;
}
return user;
}).
then(user => {
// console.log('Lgn-Ok');
if (user) {
return user.generateAuthToken(req).then((token) => {
var usertosend = new User();
@@ -421,6 +414,7 @@ router.post('/login', (req, res) => {
return (subscribe !== null);
}).
then(subsExistonDb => {
// console.log('ESEGUITO OK')
return {
usertosend: myris.usertosend,
token: myris.token,
@@ -451,7 +445,7 @@ router.post('/login', (req, res) => {
}
}).
catch((e) => {
tools.mylog('ERRORE IN LOGIN: ' + e.message);
console.error('ERRORE IN LOGIN: ' + e.message);
if (!resalreadysent)
res.status(400).
send({code: server_constants.RIS_CODE_LOGIN_ERR_GENERIC});
@@ -918,18 +912,34 @@ async function eseguiDbOp(idapp, mydata, locale) {
} else if (mydata.dbop === 'emptyDbSkill') {
// Svuota e Ricrea
const {Sector} = require('../models/sector');
const {Skill} = require('../models/skill');
const {SubSkill} = require('../models/subskill');
const {City} = require('../models/city');
const {Province} = require('../models/province');
const {Contribtype} = require('../models/contribtype');
const {AdType} = require('../models/adtype');
await Sector.deleteMany({});
await Skill.deleteMany({});
await SubSkill.deleteMany({});
await Contribtype.deleteMany({});
await AdType.deleteMany({});
await populate.popolaTabelleNuove();
} else if (mydata.dbop === 'ricreaTabCitiesProvinces') {
// Svuota e Ricrea
const {City} = require('../models/city');
const {Province} = require('../models/province');
await City.deleteMany({});
await Province.deleteMany({});
await populate.popolaTabelleNuove();
} else if (mydata.dbop === 'PopulateTables') {
populate.popolaTabelleNuove();