- "La Mia Lavagna" ora è visibile il numero di Invitati che hanno i requisiti, dei propri invitati.
- Sistemato la funzione di poter Donare un invitato a qualcun'altro. - Aggiornati testi sul BOT. Per Staff Admin: - Notifica sul BOT per ogni modifica dell'invitante o eliminazione di un invitato.
This commit is contained in:
@@ -316,6 +316,8 @@ UserSchema.statics.findByCredentials = function (idapp, username, password) {
|
|||||||
UserSchema.statics.findByUsername = function (idapp, username) {
|
UserSchema.statics.findByUsername = function (idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
|
// /^bar$/i
|
||||||
|
|
||||||
return User.findOne({
|
return User.findOne({
|
||||||
'idapp': idapp,
|
'idapp': idapp,
|
||||||
'username': username,
|
'username': username,
|
||||||
@@ -336,6 +338,9 @@ UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
|
|||||||
verified_email: 1,
|
verified_email: 1,
|
||||||
'profile.teleg_id': 1,
|
'profile.teleg_id': 1,
|
||||||
'profile.saw_zoom_presentation': 1,
|
'profile.saw_zoom_presentation': 1,
|
||||||
|
'profile.email_paypal': 1,
|
||||||
|
'profile.my_dream': 1,
|
||||||
|
'profile.paymenttypes': 1,
|
||||||
made_gift: 1,
|
made_gift: 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
@@ -365,11 +370,19 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
|
|||||||
verified_email: 1,
|
verified_email: 1,
|
||||||
'profile.teleg_id': 1,
|
'profile.teleg_id': 1,
|
||||||
'profile.saw_zoom_presentation': 1,
|
'profile.saw_zoom_presentation': 1,
|
||||||
|
'profile.email_paypal': 1,
|
||||||
|
'profile.my_dream': 1,
|
||||||
|
'profile.paymenttypes': 1,
|
||||||
made_gift: 1,
|
made_gift: 1,
|
||||||
email: 1,
|
email: 1,
|
||||||
date_reg: 1,
|
date_reg: 1,
|
||||||
img: 1
|
img: 1
|
||||||
}, (err, arrrec) => {
|
}, (err, arrrec) => {
|
||||||
|
|
||||||
|
for (const rec of arrrec) {
|
||||||
|
rec.numinvitatiattivi = User.getnumInvitatiAttivi(idapp, rec.username);
|
||||||
|
}
|
||||||
|
|
||||||
return arrrec
|
return arrrec
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ router.post(process.env.LINK_UPDATE_PWD, (req, res) => {
|
|||||||
|
|
||||||
User.findByLinkTokenforgot(idapp, email, tokenforgot).then((user) => {
|
User.findByLinkTokenforgot(idapp, email, tokenforgot).then((user) => {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return res.send({code: server_constants.RIS_CODE_TOKEN_RESETPASSWORD_NOT_FOUND});
|
return res.send({ code: server_constants.RIS_CODE_TOKEN_RESETPASSWORD_NOT_FOUND });
|
||||||
} else {
|
} else {
|
||||||
// aggiorna la nuova password
|
// aggiorna la nuova password
|
||||||
user.password = password;
|
user.password = password;
|
||||||
@@ -146,7 +146,7 @@ router.post(process.env.LINK_UPDATE_PWD, (req, res) => {
|
|||||||
|
|
||||||
// Salva lo User
|
// Salva lo User
|
||||||
user.save().then(() => {
|
user.save().then(() => {
|
||||||
res.header('x-auth', token).send({code: server_constants.RIS_CODE_OK}); // Ritorna il token di ritorno
|
res.header('x-auth', token).send({ code: server_constants.RIS_CODE_OK }); // Ritorna il token di ritorno
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -255,6 +255,7 @@ router.post('/gettable', authenticate, (req, res) => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
router.patch('/chval', authenticate, (req, res) => {
|
router.patch('/chval', authenticate, (req, res) => {
|
||||||
// const idapp = req.body.idapp;
|
// const idapp = req.body.idapp;
|
||||||
const id = req.body.data.id;
|
const id = req.body.data.id;
|
||||||
@@ -267,20 +268,39 @@ router.patch('/chval', authenticate, (req, res) => {
|
|||||||
tools.mylogshow('PATCH CHVAL: ', id, fieldsvalue);
|
tools.mylogshow('PATCH CHVAL: ', id, fieldsvalue);
|
||||||
|
|
||||||
// If I change my record...
|
// If I change my record...
|
||||||
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) && !(req.user._id.toString() === id)) {
|
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) && !(req.user._id.toString() === id) && !tools.ModificheConsentite(mydata.table, fieldsvalue)) {
|
||||||
// If without permissions, exit
|
// If without permissions, exit
|
||||||
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
||||||
}
|
}
|
||||||
|
|
||||||
mytable.findByIdAndUpdate(id, { $set: fieldsvalue }).then((rec) => {
|
mytable.findByIdAndUpdate(id, { $set: fieldsvalue }).then(async (rec) => {
|
||||||
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
||||||
if (!rec) {
|
if (!rec) {
|
||||||
return res.status(404).send();
|
return res.status(404).send();
|
||||||
} else {
|
} else {
|
||||||
if (mydata.notifBot) {
|
if (mydata.notifBot) {
|
||||||
// Send Notification to the BOT
|
// Send Notification to the BOT
|
||||||
telegrambot.sendMsgTelegram(idapp, mydata.notifBot.un, mydata.notifBot.txt)
|
telegrambot.sendMsgTelegram(idapp, mydata.notifBot.un, mydata.notifBot.txt);
|
||||||
|
addtext = '[Msg Inviato a ' + mydata.notifBot.un + ']:' + '\n' + mydata.notifBot.txt;
|
||||||
|
telegrambot.sendMsgTelegramToTheManagers(idapp, addtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tools.ModificheConsentite(mydata.table, fieldsvalue)) {
|
||||||
|
let msg = '';
|
||||||
|
if (mydata.table === 'users') {
|
||||||
|
if ('aportador_solidario' in fieldsvalue) {
|
||||||
|
const nomecognomenuovo = await User.getNameSurnameByUsername(idapp, fieldsvalue.aportador_solidario);
|
||||||
|
const nomecognomeas = await User.getNameSurnameByUsername(idapp, rec.aportador_solidario);
|
||||||
|
msg = `Variato l'invitante di ` + rec.name + ' ' + rec.surname + '\nmodificato da ' + req.user.name + ' ' + req.user.surname + ' \n' +
|
||||||
|
'Prima: ' + nomecognomeas + ' (' + rec.aportador_solidario + ')\n' +
|
||||||
|
'Dopo: ' + nomecognomenuovo + ' (' + fieldsvalue.aportador_solidario + ') ]';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg !== '')
|
||||||
|
telegrambot.sendMsgTelegramToTheManagers(idapp, msg);
|
||||||
|
}
|
||||||
|
|
||||||
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -292,48 +312,52 @@ router.patch('/chval', authenticate, (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get('/copyfromapptoapp/:idapporig/:idappdest', async (req, res) => {
|
router.get('/copyfromapptoapp/:idapporig/:idappdest', async (req, res) => {
|
||||||
const idapporig = req.params.idapporig;
|
// const idapporig = req.params.idapporig;
|
||||||
const idappdest = req.params.idappdest;
|
// const idappdest = req.params.idappdest;
|
||||||
if (!idapporig || !idappdest)
|
// if (!idapporig || !idappdest)
|
||||||
res.status(400).send();
|
// res.status(400).send();
|
||||||
|
//
|
||||||
const mytablesstr = ['settings', 'users', 'templemail', 'contribtype'];
|
// const mytablesstr = ['settings', 'users', 'templemail', 'contribtype'];
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
let numrectot = 0;
|
// let numrectot = 0;
|
||||||
for (const table of mytablesstr) {
|
// for (const table of mytablesstr) {
|
||||||
const mytable = getTableByTableName(table);
|
// const mytable = getTableByTableName(table);
|
||||||
|
//
|
||||||
tools.mylogshow('copyfromapptoapp: ', table, mytable);
|
// tools.mylogshow('copyfromapptoapp: ', table, mytable);
|
||||||
|
//
|
||||||
await mytable.DuplicateAllRecords(idapporig, idappdest).then((numrec) => {
|
// await mytable.DuplicateAllRecords(idapporig, idappdest).then((numrec) => {
|
||||||
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
// // tools.mylogshow(' REC TO MODIFY: ', rec);
|
||||||
numrectot += numrec
|
// numrectot += numrec
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
res.send({ code: server_constants.RIS_CODE_OK, msg: '', numrectot });
|
// res.send({ code: server_constants.RIS_CODE_OK, msg: '', numrectot });
|
||||||
|
//
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
tools.mylogserr('Error copyfromapptoapp: ', e);
|
// tools.mylogserr('Error copyfromapptoapp: ', e);
|
||||||
res.status(400).send();
|
// res.status(400).send();
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
router.delete('/delrec/:table/:id', authenticate, (req, res) => {
|
router.delete('/delrec/:table/:id', authenticate, (req, res) => {
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
|
const idapp = req.user.idapp;
|
||||||
const tablename = req.params.table;
|
const tablename = req.params.table;
|
||||||
|
let notifBot = false;
|
||||||
// const idapp = req.body.idapp;
|
// const idapp = req.body.idapp;
|
||||||
|
|
||||||
console.log('id', id, 'table', tablename);
|
console.log('id', id, 'table', tablename);
|
||||||
|
|
||||||
const mytable = getTableByTableName(tablename);
|
const mytable = getTableByTableName(tablename);
|
||||||
|
|
||||||
if (!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) {
|
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) && (tablename !== 'extralist')) {
|
||||||
// If without permissions, exit
|
// If without permissions, exit
|
||||||
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notifBot = tools.NotifyIfDelRecord(tablename);
|
||||||
|
|
||||||
return mytable.findByIdAndRemove(id).then((rec) => {
|
return mytable.findByIdAndRemove(id).then((rec) => {
|
||||||
if (!rec) {
|
if (!rec) {
|
||||||
return res.status(404).send();
|
return res.status(404).send();
|
||||||
@@ -344,6 +368,19 @@ router.delete('/delrec/:table/:id', authenticate, (req, res) => {
|
|||||||
// Do extra things after deleted
|
// Do extra things after deleted
|
||||||
return actions.doOtherThingsAfterDeleted(tablename, rec).then((ris) => {
|
return actions.doOtherThingsAfterDeleted(tablename, rec).then((ris) => {
|
||||||
if (ris) {
|
if (ris) {
|
||||||
|
|
||||||
|
if (notifBot) {
|
||||||
|
// Send Notification to the BOT
|
||||||
|
let nomerecord = '';
|
||||||
|
if ((tablename === 'users') || (tablename === 'extralist')) {
|
||||||
|
nomerecord = rec.name + ' ' + rec.surname + ' (' + rec.username + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
addtext = 'Eliminato il Record "' + nomerecord + '" dalla tabella ' + tablename + '\n' +
|
||||||
|
'Eseguito da ' + req.user.name + ' ' + req.user.surname + ' \n';
|
||||||
|
telegrambot.sendMsgTelegramToTheManagers(idapp, addtext);
|
||||||
|
}
|
||||||
|
|
||||||
tools.mylog('DELETED Others things ...');
|
tools.mylog('DELETED Others things ...');
|
||||||
return res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
return res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
||||||
}
|
}
|
||||||
@@ -562,7 +599,7 @@ router.post('/upload_from_other_server/:dir', authenticate, (req, res) => {
|
|||||||
if (!!dir)
|
if (!!dir)
|
||||||
await client.createDir(dir);
|
await client.createDir(dir);
|
||||||
|
|
||||||
const miofile = (dir) ? dir + `/` + file.name : file.name;
|
const miofile = (dir) ? dir + ` / ` + file.name : file.name;
|
||||||
console.log('Upload...');
|
console.log('Upload...');
|
||||||
const ret = await client.upload(file.path, miofile, 755);
|
const ret = await client.upload(file.path, miofile, 755);
|
||||||
console.log('Uploaded ' + file.name, 'status:', ret);
|
console.log('Uploaded ' + file.name, 'status:', ret);
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ const emo = {
|
|||||||
YELLOW_HEART: emoji.get('yellow_heart'),
|
YELLOW_HEART: emoji.get('yellow_heart'),
|
||||||
PURPLE_HEART: emoji.get('purple_heart'),
|
PURPLE_HEART: emoji.get('purple_heart'),
|
||||||
GIFT_HEART: emoji.get('gift_heart'),
|
GIFT_HEART: emoji.get('gift_heart'),
|
||||||
|
ROBOT_FACE: emoji.get('robot_face'),
|
||||||
|
ADMIN: emoji.get('information_desk_person'),
|
||||||
};
|
};
|
||||||
|
|
||||||
function getemojibynumber(number) {
|
function getemojibynumber(number) {
|
||||||
@@ -101,15 +103,21 @@ const StatusMSGALL = {
|
|||||||
|
|
||||||
const txt = {
|
const txt = {
|
||||||
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Scegli una voce di menu:' + emoji.get('dizzy'),
|
MSG_SCEGLI_MENU: emoji.get('dizzy') + ' Scegli una voce di menu:' + emoji.get('dizzy'),
|
||||||
MSG_ASK_USERNAME_BO: 'Inserire lo username con cui ti sei registrato sul sito %s:',
|
MSG_ASK_USERNAME_BO: 'Scrivi nel messaggio lo username o la email con cui ti sei registrato sul sito di %s:',
|
||||||
MSG_ERRORE_USERNAME: 'Attenzione! Devi inserire solo lo username (20 caratteri massimo)',
|
MSG_ERRORE_USERNAME: 'Attenzione! Devi inserire solo lo username (20 caratteri massimo)',
|
||||||
MSG_ERRORE_USERNAME_NOT_FOUND: 'Attenzione! Username non trovato in archivio. Verifica che sia corretto.',
|
MSG_ERRORE_USERNAME_NOT_FOUND: 'Attenzione! Username o email non trovata in archivio.\nVerifica che sia corretta e riscrivila nuovamente.',
|
||||||
MSG_ERRORE_USERNAME_ANNULLA: 'Inserimento Annullato. Riprovare',
|
MSG_ERRORE_USERNAME_ANNULLA: 'Inserimento Annullato. Riprovare',
|
||||||
MSG_OPERAZ_ANNULLATA: 'Operazione Annullata',
|
MSG_OPERAZ_ANNULLATA: 'Operazione Annullata',
|
||||||
MSG_ERRORE_VERIFY_CODE_MAXLEN: 'Attenzione! Devi inserire solo il codice a 6 cifre',
|
MSG_ERRORE_VERIFY_CODE_MAXLEN: 'Attenzione! Devi inserire solo il codice a 6 cifre',
|
||||||
MSG_VERIFY_CODE: 'Ritorna sul sito cliccando qui %s, poi torna qui e scrivi il Codice di Autenticazione che vedrai visualizzato',
|
MSG_VERIFY_CODE: 'Copia il codice di Autenticazione che troverai visualizzato sul sito %s, ed incollalo qui sotto',
|
||||||
MSG_ERR_VERIFY_CODE: 'Codice di Verifica Errato! Controllare sul Sito e reinserire il nuovo codice di 6 cifre.',
|
MSG_ERR_VERIFY_CODE: 'Codice di Verifica Errato! Controlla sul sito %s e riscrivi il nuovo codice di 6 cifre.',
|
||||||
MSG_VERIFY_OK: emoji.get('grinning') + ' Benvenuto %s. Sono il tuo BOT. Chiedi utilizzando il menu che trovi in basso.\nOra sei correttamente verificato!\nContinua la guida passo passo che trovi sul sito. Qui puoi ritornare per vedere La tua Lavagna in maniera rapida, senza passare dal sito.',
|
MSG_VERIFY_OK: emoji.get('grinning') + ' Benvenuto %s! Sono AYNI BOT, il tuo assistente virtuale.\n' +
|
||||||
|
'Clicca nei menu qui sotto, per accedere alle mie funzioni.',
|
||||||
|
|
||||||
|
// ' - In "La tua Lavagna" puoi controllare se hai completato la lista dei requisiti per entrare in programmazione Bigliettera.\n' +
|
||||||
|
// ' - in "Zoom (Conferenze) troverai le date dei prossimi Zoom da condividere con i tuoi invitati.\n' +
|
||||||
|
// ' - in "Link da condividere" trovi i link ',
|
||||||
|
|
||||||
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Errore durante il salvataggio sul Server. Riprovare piú tardi',
|
MSG_ERR_UNKNOWN_VERIFY_CODE: 'Errore durante il salvataggio sul Server. Riprovare piú tardi',
|
||||||
MSG_EXIT_TELEGRAM: 'L\'account è stato ora scollegato da questo Telegram BOT.',
|
MSG_EXIT_TELEGRAM: 'L\'account è stato ora scollegato da questo Telegram BOT.',
|
||||||
MSG_APORTADOR_USER_REGISTERED: emo.FIRE + ' Si è appena Registrato "%s (n. %s)"\n(Invitato da %s)',
|
MSG_APORTADOR_USER_REGISTERED: emo.FIRE + ' Si è appena Registrato "%s (n. %s)"\n(Invitato da %s)',
|
||||||
@@ -167,7 +175,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (usersmanagers) {
|
if (usersmanagers) {
|
||||||
for (const rec of usersmanagers) {
|
for (const rec of usersmanagers) {
|
||||||
this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, text)
|
this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + '[BOT-STAFF]' +emo.ADMIN + ': ' + text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,8 +326,10 @@ class Telegram {
|
|||||||
// mystr += `____________________________________________\n`;
|
// mystr += `____________________________________________\n`;
|
||||||
|
|
||||||
if (rec.user) {
|
if (rec.user) {
|
||||||
mystr += tools.get__('BENVENUTO', msg) + ' ' + rec.user.name + ' (' + rec.user.username + ') ' + emo.DIZZY;
|
mystr += tools.get__('BENVENUTO', msg) + ' ' + rec.user.name + ' (' + rec.user.username + ') ' + emo.DIZZY + '\n\n';
|
||||||
mystr += '\n' + '\n' + this.getsymb(emo.ENVELOPE, rec.user.verified_email);
|
mystr += tools.get__('INFO_LA_MIA_LAVAGNA', msg);
|
||||||
|
|
||||||
|
mystr += '\n' + this.getsymb(emo.ENVELOPE, rec.user.verified_email);
|
||||||
mystr += rec.user.verified_email ? tools.get__('EMAIL_VERIF', msg) : tools.get__('EMAIL_NON_VERIF', msg);
|
mystr += rec.user.verified_email ? tools.get__('EMAIL_VERIF', msg) : tools.get__('EMAIL_NON_VERIF', msg);
|
||||||
|
|
||||||
mystr += '\n' + '\n' + this.getsymb(emo.EYES, rec.user.profile.saw_zoom_presentation) + tools.get__('ZOOM_PARTECIPATO', msg);
|
mystr += '\n' + '\n' + this.getsymb(emo.EYES, rec.user.profile.saw_zoom_presentation) + tools.get__('ZOOM_PARTECIPATO', msg);
|
||||||
@@ -353,6 +363,9 @@ class Telegram {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mystr += '\n' + printf(tools.get__('INFO_LAVAGNA_SITO', msg), tools.getHostByIdApp(this.idapp));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!!mystr)
|
if (!!mystr)
|
||||||
@@ -362,8 +375,9 @@ class Telegram {
|
|||||||
|
|
||||||
async menuLinkCondividere(msg) {
|
async menuLinkCondividere(msg) {
|
||||||
const rec = this.getRecInMem(msg);
|
const rec = this.getRecInMem(msg);
|
||||||
|
let mystr = '';
|
||||||
if (rec.user) {
|
if (rec.user) {
|
||||||
const mystr = tools.getHostByIdApp(this.idapp) + '/signup/' + rec.user.username;
|
mystr += printf(tools.get__('INFO_LINK_DA_CONDIVIDERE', msg), tools.getHostByIdApp(this.idapp) + '/signup/' + rec.user.username, tools.getlinkzoom(''));
|
||||||
await this.sendMsg(msg.chat.id, mystr);
|
await this.sendMsg(msg.chat.id, mystr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -391,7 +405,7 @@ class Telegram {
|
|||||||
|
|
||||||
const nextzoom = await CalZoom.getNextZoom(this.idapp);
|
const nextzoom = await CalZoom.getNextZoom(this.idapp);
|
||||||
|
|
||||||
mystr += emo.STARS + 'Zoom in programma:' + emo.STARS + '\n\n';
|
mystr += emo.STARS + tools.get__('ZOOM_CONFERENCE') + emo.STARS + '\n\n';
|
||||||
|
|
||||||
let index = 1;
|
let index = 1;
|
||||||
listazoom.forEach((evento) => {
|
listazoom.forEach((evento) => {
|
||||||
@@ -492,14 +506,17 @@ class Telegram {
|
|||||||
const text = msg.text;
|
const text = msg.text;
|
||||||
if (text.length < 20) {
|
if (text.length < 20) {
|
||||||
if (rec) {
|
if (rec) {
|
||||||
rec.username_bo = text;
|
rec.username_bo = text.trim();
|
||||||
|
|
||||||
// Check if username exist
|
// Check if username exist
|
||||||
const user = await
|
const user = await User.findByUsername(this.idapp, rec.username_bo);
|
||||||
User.findByUsername(this.idapp, rec.username_bo);
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
await this.sendMsg(msg.from.id, txt.MSG_ERRORE_USERNAME_NOT_FOUND);
|
rec.username_bo = text.toLowerCase().trim();
|
||||||
rec.username_bo = '';
|
const user = await User.findByEmail(this.idapp, rec.username_bo);
|
||||||
|
if (!user) {
|
||||||
|
await this.sendMsg(msg.from.id, txt.MSG_ERRORE_USERNAME_NOT_FOUND);
|
||||||
|
rec.username_bo = '';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rec.user = user;
|
rec.user = user;
|
||||||
await
|
await
|
||||||
@@ -556,7 +573,7 @@ class Telegram {
|
|||||||
if (rec.retry < 2) {
|
if (rec.retry < 2) {
|
||||||
rec.retry++;
|
rec.retry++;
|
||||||
await
|
await
|
||||||
this.sendMsg(msg.from.id, txt.MSG_ERR_VERIFY_CODE)
|
this.sendMsg(msg.from.id, printf(txt.MSG_ERR_VERIFY_CODE, tools.getHostByIdApp(this.idapp)));
|
||||||
} else {
|
} else {
|
||||||
rec.status = Status.NONE;
|
rec.status = Status.NONE;
|
||||||
await
|
await
|
||||||
@@ -675,8 +692,8 @@ class Telegram {
|
|||||||
await
|
await
|
||||||
this.addUser(msg);
|
this.addUser(msg);
|
||||||
|
|
||||||
await
|
// await this.sendMsg(msg.chat.id, getstr(msg.from.language_code, printf(txt.MSG_ASK_USERNAME_BO, tools.getHostByIdApp(this.idapp))));
|
||||||
this.sendMsg(msg.chat.id, getstr(msg.from.language_code, printf(txt.MSG_ASK_USERNAME_BO, tools.getHostByIdApp(this.idapp))));
|
await this.sendMsg(msg.chat.id, getstr(msg.from.language_code, printf(txt.MSG_ASK_USERNAME_BO, tools.getNomeAppByIdApp(this.idapp))));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,12 @@ textlang = {
|
|||||||
"Nuova Registrazione": "Nuova Registrazione",
|
"Nuova Registrazione": "Nuova Registrazione",
|
||||||
"Effettuata una Nuova Registrazione": "Effettuata una Nuova Registrazione",
|
"Effettuata una Nuova Registrazione": "Effettuata una Nuova Registrazione",
|
||||||
"partecipanti": "partecipanti",
|
"partecipanti": "partecipanti",
|
||||||
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità.",
|
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
|
||||||
'BENVENUTO': "Benvenuto",
|
'BENVENUTO': "Benvenuto",
|
||||||
|
'INFO_LA_MIA_LAVAGNA': 'In questa sezione puoi controllare se hai completato la lista dei requisiti per entrare in programmazione Bigliettera:\n',
|
||||||
|
'INFO_LAVAGNA_SITO': 'Per accedere al menu completo vai sul sito %s, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "La tua Lavagna".\n',
|
||||||
|
'INFO_LINK_DA_CONDIVIDERE': 'Link da condividere ai tuoi invitati per farli registrare al sito di Ayni:\n%s\n\nLink da condividere per partecipare allo Zoom (Conferenza OnLine):\n%s',
|
||||||
|
'ZOOM_CONFERENCE': 'Qui trovi le date di programmazione agli Zoom:',
|
||||||
'EMAIL_VERIF': "Email Verificata",
|
'EMAIL_VERIF': "Email Verificata",
|
||||||
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
|
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
|
||||||
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
|
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
|
||||||
@@ -62,8 +66,12 @@ textlang = {
|
|||||||
"Effettuata una Nuova Registrazione": "Se ha realizado un nuevo registro",
|
"Effettuata una Nuova Registrazione": "Se ha realizado un nuevo registro",
|
||||||
"partecipanti": "participantes",
|
"partecipanti": "participantes",
|
||||||
|
|
||||||
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità.",
|
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
|
||||||
'BENVENUTO': "Benvenuto",
|
'BENVENUTO': "Benvenuto",
|
||||||
|
'INFO_LA_MIA_LAVAGNA': 'In questa sezione puoi controllare se hai completato la lista dei requisiti per entrare in programmazione Bigliettera:\n',
|
||||||
|
'INFO_LAVAGNA_SITO': 'Per accedere al menu completo vai sul sito %s, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "La tua Lavagna".\n',
|
||||||
|
'INFO_LINK_DA_CONDIVIDERE': 'Link da condividere ai tuoi invitati per farli registrare al sito di Ayni:\n%s\n\nLink da condividere per partecipare allo Zoom (Conferenza OnLine):\n%s',
|
||||||
|
'ZOOM_CONFERENCE': 'Qui trovi le date di programmazione agli Zoom:',
|
||||||
'EMAIL_VERIF': "Email Verificata",
|
'EMAIL_VERIF': "Email Verificata",
|
||||||
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
|
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
|
||||||
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
|
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
|
||||||
@@ -75,8 +83,12 @@ textlang = {
|
|||||||
},
|
},
|
||||||
us: {
|
us: {
|
||||||
"partecipanti": "participants",
|
"partecipanti": "participants",
|
||||||
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità.",
|
'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Fai la tua domanda e chiedi assistenza.\n2 - Dopo aver ricevuto aiuto esci dalla chat.\nPotrai rientrare ogni qualvolta ne avrai la necessità.",
|
||||||
'BENVENUTO': "Benvenuto",
|
'BENVENUTO': "Benvenuto",
|
||||||
|
'INFO_LA_MIA_LAVAGNA': 'In questa sezione puoi controllare se hai completato la lista dei requisiti per entrare in programmazione Bigliettera:\n',
|
||||||
|
'INFO_LAVAGNA_SITO': 'Per accedere al menu completo vai sul sito %s, clicca sulle 3 linee in alto a sinistra ed accedi alla voce "La tua Lavagna".\n',
|
||||||
|
'INFO_LINK_DA_CONDIVIDERE': 'Link da condividere ai tuoi invitati per farli registrare al sito di Ayni:\n%s\n\nLink da condividere per partecipare allo Zoom (Conferenza OnLine):\n%s',
|
||||||
|
'ZOOM_CONFERENCE': 'Qui trovi le date di programmazione agli Zoom:',
|
||||||
'EMAIL_VERIF': "Email Verificata",
|
'EMAIL_VERIF': "Email Verificata",
|
||||||
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
|
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**<br>e clicca sul bottone **\"Verifica Registrazione\"**",
|
||||||
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
|
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
|
||||||
@@ -728,6 +740,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getlinkzoom(idconf) {
|
getlinkzoom(idconf) {
|
||||||
|
if (idconf === '')
|
||||||
|
idconf = '8886662000';
|
||||||
return 'https://zoom.us/j/' + idconf
|
return 'https://zoom.us/j/' + idconf
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -907,5 +921,23 @@ module.exports = {
|
|||||||
return mystr.replace(/\s+/g, '')
|
return mystr.replace(/\s+/g, '')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ModificheConsentite(table, fieldsvalue) {
|
||||||
|
if (table === 'users') {
|
||||||
|
if ('aportador_solidario' in fieldsvalue) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
NotifyIfDelRecord(table) {
|
||||||
|
if ((table === 'users') || (table === 'extralist')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user