Aggiornamento Ore

This commit is contained in:
Paolo Arena
2021-03-17 02:24:11 +01:00
parent 4800186161
commit 678d8ecd6b
14 changed files with 209 additions and 69 deletions

View File

@@ -94,15 +94,17 @@ router.post('/', async (req, res) => {
// Controlla se anche l'ultimo record era dallo stesso IP:
const lastrec = await User.getLastRec(body.idapp);
if (!!lastrec) {
if (lastrec.ipaddr === user.ipaddr) {
// Se l'ha fatto troppo ravvicinato
if (lastrec.date_reg) {
let ris = tools.isdiffSecDateLess(lastrec.date_reg, 120);
if (ris) {
tools.writeIPToBan(user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' + user.surname);
await tools.snooze(10000);
res.status(400).send({ code: server_constants.RIS_CODE_BANIP, msg: '' });
return 1;
if (process.env.LOCALE !== "1") {
if (lastrec.ipaddr === user.ipaddr) {
// Se l'ha fatto troppo ravvicinato
if (lastrec.date_reg) {
let ris = tools.isdiffSecDateLess(lastrec.date_reg, 120);
if (ris) {
tools.writeIPToBan(user.ipaddr + ': [' + user.username + '] ' + user.name + ' ' + user.surname);
await tools.snooze(10000);
res.status(400).send({ code: server_constants.RIS_CODE_BANIP, msg: '' });
return 1;
}
}
}
}
@@ -279,9 +281,9 @@ router.post('/', async (req, res) => {
// Invia un'email all'utente
// tools.mylog('process.env.TESTING_ON', process.env.TESTING_ON);
console.log('res.locale', res.locale);
if (!tools.testing()) {
// if (!tools.testing()) {
await sendemail.sendEmail_Registration(user.lang, user.email, user, user.idapp, user.linkreg);
}
// }
res.header('x-auth', token).send(user);
return true;
});