- Chart Maps Nationality

- Username lowercase
- Statistics
- Telegram
This commit is contained in:
Paolo Arena
2020-01-27 15:07:53 +01:00
parent f5355c3a54
commit 25ad3e91c2
11 changed files with 262 additions and 76 deletions

View File

@@ -53,7 +53,7 @@ router.post('/', async (req, res) => {
user.linkreg = reg.getlinkregByEmail(body.idapp, body.email, body.username);
user.verified_email = false;
user.ipaddr = reg.getiPAddressUser(req);
user.ipaddr = tools.getiPAddressUser(req);
user.lasttimeonline = new Date();
user.date_reg = new Date();
user.date_temp_reg = new Date();
@@ -62,6 +62,11 @@ router.post('/', async (req, res) => {
user.verified_email = true;
}
if (user.profile.intcode_cell) {
if (user.profile.cell.substring(0, user.profile.intcode_cell.length) === user.profile.intcode_cell) {
user.profile.cell = user.profile.cell.substring(user.profile.intcode_cell.length)
}
}
let exit;
// Check if already esist email or username
@@ -98,6 +103,21 @@ router.post('/', async (req, res) => {
nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname;
}
const lastuser = await User.getLastUser(user.idapp);
const lastextra = await ExtraList.getLastUser(user.idapp);
let lastindorder = 0;
if (lastuser) {
lastindorder = lastuser.ind_order;
}
if (lastextra) {
if (lastextra.ind_order > lastindorder)
lastindorder = lastextra.ind_order;
}
if (lastindorder > 0)
user.ind_order = lastindorder + 1;
namesurname_aportador_reg = await User.getNameSurnameByUsername(user.idapp, user.aportador_solidario);
@@ -119,6 +139,9 @@ router.post('/', async (req, res) => {
if (already_registered) {
// Check in the extraList if is present!
if (!recextra) {
console.log('Utente non trovato; ', user);
const msg = 'Utente non trovato: ' + user.name + ' ' + user.surname + ' ' + user.profile.nationality + ' ' + user.profile.intcode_cell + user.profile.cell + ' email: ' + user.email + ' username: ' + user.username;
telegrambot.sendMsgTelegramToTheManagers(user.idapp, msg);
res.status(400).send({ code: server_constants.RIS_CODE_USER_EXTRALIST_NOTFOUND, msg: '' });
return 1;
} else {
@@ -247,7 +270,9 @@ router.post('/login', (req, res) => {
.then((user) => {
// tools.mylog("CREDENZIALI ! ");
if (!user) {
tools.mylogshow("NOT FOUND !");
tools.mylogshow("Errore LOGIN ! Username o password Errati: ", body.username, body.password);
const msg = "Tentativo di Login ERRATO [" + body.username + ' , ' + body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) + ']';
telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR });
}
return user