- Nuovi Passi da completare: Leggere le Linee Guida e accettare le condizioni

- Aggiunti i Video e confermare di averli visti
 - In "La tua Lavagna" sono stati aggiunti come requisiti: (Accetto le Linee Guida e Vedo il Video di AYNI)
 - Aggiunto bottone "Invita Persone": apre la pagina dove c'è il messaggio da inviare alle persone.
 - La nuova pagina di registrazione https://test.gifteconomy.app/signup/paoloar77, comprende ora il testo delle Linee Guida + i Video, ed in fondo i campi per registrarsi.
This commit is contained in:
Paolo Arena
2020-02-07 22:08:46 +01:00
parent a8bec7686a
commit eccb5bbb57
20 changed files with 403 additions and 135 deletions

View File

@@ -2,8 +2,8 @@ p Benvenuto #{name} nel portale di #{nomeapp}!
p I tuoi dati di accesso da ricordare sono:
span Username: 
strong #{username}<br>
span Password :&nbsp; (** non mostrata per privacy **)<br>
span hai dimenticato la Password? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Trovala qui</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p Per confermare la registrazione clicca sul bottone:

View File

@@ -1,13 +0,0 @@
Benvenuto #{name} nel portale di #{nomeapp}!
I tuoi dati di accesso da ricordare sono:
Username: #{username}
hai dimenticato la Password?
Trovala qui: #{forgetpwd}
Email #{emailto}
Per confermare la registrazione clicca su questo link:
#{strlinkreg}
Potrai cosi' accedere al sito digitando i tuoi dati di accesso.

View File

@@ -0,0 +1,39 @@
p Welcome #{name} to the portal #{nomeapp}!
p Your access data to remember are:
span Username:&nbsp;
strong #{username}<br>
span Forgot your Password? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Find it here</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p To confirm the registration click on the button:
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Verify Registration</a>
p You can then access your personal area by clicking on LOGIN and filling in all the STEPS required by :&nbsp;
strong "Step by Step Guide" !<br>
style(type="text/css").
html, body {
padding: 0;
margin: 0;
}
.divbtn {
display: flex;
align-items: center;
justify-content: center;
}
.btn-lg {
padding: 5px;
margin: 5px;
font-size: 26px;
cursor: pointer;
color: white;
background: #027be3 !important;
border-radius: 28px;
}

View File

@@ -0,0 +1 @@
=`Confirm Registration to ${nomeapp}`

View File

@@ -0,0 +1,38 @@
p ¡Bienvenido #{name} al portal #{nomeapp}!
p Sus datos de acceso a recordar son:
Nombre Usuario:&nbsp;
strong #{username}<br>
span ¿Olvidaste tu contraseña? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Encuéntrelo aquí</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p Para confirmar el registro haz clic en el botón:
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Verificar registro</a>
p A continuación, puede acceder a su área personal haciendo clic en INICIAR SESIÓN y rellenando todos los PASOS requeridos por :&nbsp;
strong "Guía paso a paso"!<br>
style(type="text/css").
html, body {
padding: 0;
margin: 0;
}
.divbtn {
display: flex;
align-items: center;
justify-content: center;
}
.btn-lg {
padding: 5px;
margin: 5px;
font-size: 26px;
cursor: pointer;
color: white;
background: #027be3 !important;
border-radius: 28px;
}

View File

@@ -0,0 +1 @@
=`Confirmar registro a ${nomeapp}`

View File

@@ -0,0 +1,38 @@
p Benvenuto #{name} nel portale di #{nomeapp}!
p I tuoi dati di accesso da ricordare sono:
span Username:&nbsp;
strong #{username}<br>
span hai dimenticato la Password? :&nbsp;
strong <a href=#{forgetpwd} target="_blank">Trovala qui</a><br>
span Email:&nbsp;
strong #{emailto}<br>
p Per confermare la registrazione clicca sul bottone:
div.divbtn <a href=#{strlinkreg} target="_blank">
button.btn.btn-lg Verifica Registrazione</a>
p Potrai cosi' accedere alla tua area personale cliccando su LOGIN e compilando tutti i PASSI richiesti dalla :&nbsp;
strong "Guida Passo Passo" !<br>
style(type="text/css").
html, body {
padding: 0;
margin: 0;
}
.divbtn {
display: flex;
align-items: center;
justify-content: center;
}
.btn-lg {
padding: 5px;
margin: 5px;
font-size: 26px;
cursor: pointer;
color: white;
background: #027be3 !important;
border-radius: 28px;
}

View File

@@ -0,0 +1 @@
=`Confermare la Registrazione a ${nomeapp}`

View File

@@ -33,6 +33,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '2',
@@ -47,6 +48,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '3',
@@ -61,6 +63,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '4',
@@ -75,6 +78,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '6',
@@ -89,6 +93,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '7',
@@ -103,6 +108,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: 'b72b121f6fb69f7c58a269f5b5110e179430cd6fa940a168c2c10b255aa75fd1ebql9yXWoH1LwANdHD7Yvw==',
telegram_key:'1037577457:AAGQbdIuYoB838v61ewJ0Hearx9UPpTBhMI',
telegram_bot_name: 'notevoleaynibot',
pathreg_add:'_ayni',
},
{
idapp: '8',
@@ -117,6 +123,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
];
} else if (process.env.NODE_ENV === 'test') {
@@ -135,6 +142,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '2',
@@ -149,6 +157,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '3',
@@ -162,6 +171,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '4',
@@ -175,6 +185,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '6',
@@ -188,6 +199,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '7',
@@ -201,6 +213,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'1011893908:AAEThZB3fVPw8P5gTCFgTEsDmY21DdbV1Cw',
telegram_bot_name: 'testnotevoleaynibot',
pathreg_add:'_ayni',
},
{
idapp: '8',
@@ -215,6 +228,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
];
} else {
@@ -233,6 +247,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '2',
@@ -247,6 +262,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '3',
@@ -258,6 +274,7 @@ if (process.env.NODE_ENV === 'production') {
dir: '',
email_from: 'info.pianetalibero@gmail.com',
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
pathreg_add:'',
},
{
idapp: '4',
@@ -271,6 +288,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '6',
@@ -284,6 +302,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
{
idapp: '7',
@@ -297,6 +316,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_bot_name: 'paotestlocalebot',
telegram_key:'353996190:AAEcEbfrm_zTK6mBKf8ye9j-PXt958SDxew',
pathreg_add:'_ayni',
},
{
idapp: '8',
@@ -311,6 +331,7 @@ if (process.env.NODE_ENV === 'production') {
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
telegram_key:'',
telegram_bot_name: '',
pathreg_add:'',
},
];

View File

@@ -123,7 +123,7 @@ NewstosentSchema.statics.findNewsletterPending_To_Send = function (idapp) {
starting_job: true,
finish_job: false,
processing_job: false,
lastemailsent_Job: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 8) },
lastemailsent_Job: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 15) },
idapp
}).then((rec) => {
// console.log('findNewsletterPending_To_Send', rec);

View File

@@ -172,6 +172,9 @@ const UserSchema = new mongoose.Schema({
my_dream: {
type: String,
},
saw_and_accepted: {
type: Number,
},
saw_zoom_presentation: {
type: Boolean
},
@@ -324,10 +327,10 @@ UserSchema.statics.findByUsername = function (idapp, username) {
});
};
UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
UserSchema.statics.getUserShortDataByUsername = async function (idapp, username) {
const User = this;
return User.findOne({
const myrec = await User.findOne({
'idapp': idapp,
'username': username,
}, {
@@ -338,6 +341,7 @@ UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
verified_email: 1,
'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1,
'profile.saw_and_accepted': 1,
'profile.email_paypal': 1,
'profile.my_dream': 1,
'profile.paymenttypes': 1,
@@ -354,11 +358,18 @@ UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
return null;
}
});
if (myrec) {
myrec.numinvitati = await User.getnumInvitati(idapp, myrec.username);
myrec.numinvitatiattivi = await User.getnumInvitatiAttivi(idapp, myrec.username);
}
return myrec
};
UserSchema.statics.getDownlineByUsername = function (idapp, username) {
UserSchema.statics.getDownlineByUsername = async function (idapp, username) {
const User = this;
return User.find({
const arrrec = await User.find({
'idapp': idapp,
'aportador_solidario': username,
}, {
@@ -370,6 +381,7 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
verified_email: 1,
'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1,
'profile.saw_and_accepted': 1,
'profile.email_paypal': 1,
'profile.my_dream': 1,
'profile.paymenttypes': 1,
@@ -378,13 +390,18 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
date_reg: 1,
img: 1
}, (err, arrrec) => {
return arrrec;
});
if (!!arrrec) {
for (const rec of arrrec) {
rec.numinvitatiattivi = User.getnumInvitatiAttivi(idapp, rec.username);
rec._doc.numinvitati = await User.getnumInvitati(idapp, rec.username);
rec._doc.numinvitatiattivi = await User.getnumInvitatiAttivi(idapp, rec.username);
}
}
return arrrec
});
};
@@ -396,6 +413,7 @@ UserSchema.statics.getnumInvitatiAttivi = function (idapp, username) {
aportador_solidario: username,
'profile.teleg_id': { $gt: 1 },
'profile.saw_zoom_presentation': true,
'profile.saw_and_accepted': true,
});
};
@@ -602,7 +620,7 @@ UserSchema.statics.getusersManagers = async function (idapp) {
UserSchema.statics.getUsersTelegALL = async function (idapp) {
const User = this;
return await User.find({ idapp, 'profile.teleg_id': { $gt: 0 } }, { 'profile.teleg_id': 1 })
return await User.find({ idapp, 'profile.teleg_id': { $gt: 0 } }, { 'profile.teleg_id': 1, perm: 1 })
.then((arrrec) => {
return (!!arrrec) ? arrrec : null;
}).catch((e) => {
@@ -729,7 +747,7 @@ UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, us
dashboard.myself = await User.getUserShortDataByUsername(idapp, username);
// Data of my Aportador
dashboard.aportador = await User.getUserShortDataByUsername(idapp, aportador_solidario);
if (dashboard.aportador === undefined ) {
if (dashboard.aportador === undefined) {
dashboard.aportador = await ExtraList.getUserNotRegisteredByNameSurname(idapp, aportador_solidario_nome_completo);
}
@@ -827,6 +845,14 @@ UserSchema.statics.getUsersZoom = async function (idapp) {
return await User.count(myfind);
};
UserSchema.statics.getSaw_and_Accepted = async function (idapp) {
const User = this;
const myfind = { idapp, 'profile.saw_and_accepted': shared_consts.ALL_SAW_AND_ACCEPTED };
return await User.count(myfind);
};
UserSchema.statics.getUsersDreams = async function (idapp) {
const User = this;

View File

@@ -279,7 +279,7 @@ router.post('/setactivate', authenticate, async (req, res) => {
locale = req.body.locale;
const rec = {
activate
activate,
};
return await Newstosent.findOneAndUpdate({ _id: id }, { $set: rec }, { new: false }).then((item) => {

View File

@@ -30,6 +30,7 @@ router.post('/load', async (req, res) => {
num_teleg_attivo: await User.getUsersTelegramAttivo(idapp),
num_teleg_pending: await User.getUsersTelegramPending(idapp),
num_part_zoom: await User.getUsersZoom(idapp),
num_part_accepted: await User.getSaw_and_Accepted(idapp),
num_users_dream: await User.getUsersDreams(idapp),
arr_nations: await User.findAllDistinctNationality(idapp),
reg_daily: await User.calcRegDaily(idapp),

View File

@@ -85,6 +85,8 @@ module.exports = {
const email = new Email(paramemail);
console.log(' *** Invia Email a ' + to);
return email
.send({
template: template,
@@ -164,12 +166,12 @@ module.exports = {
username: user.username,
name: user.name,
surname: user.surname,
forgetpwd: "",
forgetpwd: tools.getHostByIdApp(idapp) + '/requestresetpwd',
emailto: emailto,
user,
};
this.sendEmail_base('registration/' + lang, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
this.sendEmail_base(tools.getpathregByIdApp(idapp, lang), emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
// Send to the Admin an Email
this.sendEmail_base('admin/registration/' + tools.LANGADMIN, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
@@ -411,10 +413,13 @@ module.exports = {
},
replacefields: function (mylocalsconf) {
try {
mylocalsconf.dataemail.disclaimer_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disclaimer);
mylocalsconf.dataemail.disc_bottom_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.disc_bottom);
mylocalsconf.dataemail.templ.testoheadermail_out = this.fieldsloop(mylocalsconf, mylocalsconf.dataemail.templ.testoheadermail);
} catch (e) {
console.error('Error replacefields: ' + e)
}
return mylocalsconf
},
@@ -445,7 +450,7 @@ module.exports = {
};
// console.log(mydata.templemail_id);
mydata.templ = await TemplEmail.findOne({_id: mydata.templemail_id });
mydata.templ = await TemplEmail.findOne({ _id: mydata.templemail_id });
// console.log(mydata.templ);
return mydata
@@ -487,7 +492,10 @@ module.exports = {
sendEmail_Newsletter_Events: async function (lang, idapp, id_newstosent) {
console.log('INIZIO - sendEmail_Newsletter_Events', tools.getNomeAppByIdApp(idapp));
const msginizio = 'INIZIO - sendEmail_Newsletter_Events: ' + tools.getNomeAppByIdApp(idapp);
console.log(msginizio);
telegrambot.sendMsgTelegramToTheManagers(idapp, msginizio);
//++Todo Extract List Email to send
const userstosend = await MailingList.findAllIdAppSubscribed(idapp);
@@ -507,6 +515,7 @@ module.exports = {
const mynewsrec = await Newstosent.findOne({ _id: id_newstosent });
try {
mynewsrec.numemail_tot = userstosend.length;
mynewsrec.templemail_str = mylocalsconf.dataemail.templ.subject;
mynewsrec.numemail_sent = await MailingList.getnumSent(idapp, id_newstosent);
@@ -516,6 +525,8 @@ module.exports = {
// LOOP USERS EMAIL
for (const user of userstosend) {
try {
const isok = await MailingList.isOk(idapp, user._id, id_newstosent);
if (isok) {
let secpause = await Settings.getValDbSettings(idapp, 'MSEC_PAUSE_SEND', process.env.DELAY_SENDEMAIL);
@@ -527,6 +538,7 @@ module.exports = {
if (!activate) {
// Invio Newsletter Abortito!
mynewsrec.error_job = 'Invio Newsletter abortito alle ore ' + new Date().toDateString() + new Date().toTimeString();
telegrambot.sendMsgTelegramToTheManagers(idapp, mynewsrec.error_job);
await mynewsrec.save();
await Newstosent.processingJob(id_newstosent, false);
console.log('*** L\'Invio della Newsletter è stato fermato ! ');
@@ -543,7 +555,7 @@ module.exports = {
// If has already sent, don't send it again!
if (user.lastid_newstosent !== id_newstosent.toString()) {
console.log('@@@@@ COMPARE DIVERSI: lastid', user.lastid_newstosent, 'idsent', id_newstosent.toString());
// console.log('@@@@@ COMPARE DIVERSI: lastid', user.lastid_newstosent, 'idsent', id_newstosent.toString());
if (process.env.DEBUG)
await tools.snooze(5000);
@@ -552,6 +564,11 @@ module.exports = {
// console.log('-> Invio Email (', mynewsrec.numemail_sent, '/', mynewsrec.numemail_tot, ')');
const esito = this.sendEmail_base('newsletter/' + lang, mylocalsconf.emailto, mylocalsconf, mylocalsconf.dataemail.email_reply, smtpTransport);
if ((mynewsrec.numemail_sent % 50) === 0) {
const msgproc = 'In Corso ' + mynewsrec.numemail_sent + ' / ' + mynewsrec.numemail_tot + ' Email inviate...';
telegrambot.sendMsgTelegramToTheManagers(idapp, msgproc);
}
//Put the result in the database, to check if is sent or not.
const updateml = await MailingList.findOneAndUpdate({
idapp,
@@ -570,13 +587,36 @@ module.exports = {
console.log('*** COMPARE: UGUALI !!!!! lastid', user.lastid_newstosent, 'idsent', id_newstosent.toString());
}
}
} catch (e) {
const msgerr = 'Error LOOP sendEmail_Newsletter_Events: ' + e;
console.error(msgerr);
telegrambot.sendMsgTelegramToTheManagers(idapp, msgerr);
}
}
await Newstosent.endJob(id_newstosent);
await Newstosent.processingJob(id_newstosent, false);
console.log('****', tools.getNomeAppByIdApp(idapp), mynewsrec.numemail_sent, 'Email inviate');
let msgfine = 'FINE - sendEmail_Newsletter_Events [' + tools.getNomeAppByIdApp(idapp) + ']: ';
msgfine += mynewsrec.numemail_sent + ' Email inviate';
console.log(msgfine);
telegrambot.sendMsgTelegramToTheManagers(idapp, msgfine);
} catch (e) {
activate = await Newstosent.isActivated(id_newstosent);
if (!activate) {
// Invio Newsletter Abortito!
mynewsrec.error_job = 'Invio Newsletter abortito alle ore ' + new Date().toDateString() + new Date().toTimeString();
telegrambot.sendMsgTelegramToTheManagers(idapp, mynewsrec.error_job);
await mynewsrec.save();
await Newstosent.processingJob(id_newstosent, false);
console.log('*** L\'Invio della Newsletter è stato fermato ! ');
return false
}
}
console.log('FINE (esco da funz) - sendEmail_Newsletter_Events', tools.getNomeAppByIdApp(idapp));
},
@@ -597,11 +637,11 @@ module.exports = {
return Newstosent.findNewsletterPending_To_Send(idapp)
.then((rec) => { //
this.sendNewsletter(rec)
this.sendNewsletter(rec, idapp)
});
},
sendNewsletter: async function (rec) {
sendNewsletter: async function (rec, idapp) {
if (rec) {
// Start the job
myjobnews = await Newstosent.findOne({ _id: rec._id });
@@ -612,7 +652,7 @@ module.exports = {
myjobnews.save()
.then((ris) => {
this.sendEmail_Newsletter_Events("it", '2', rec._id);
this.sendEmail_Newsletter_Events("it", idapp, rec._id);
})
.catch((e) => {
console.error(e);

View File

@@ -42,6 +42,7 @@ require('./models/mypage');
require('./models/calzoom');
const mysql_func = require('./mysql/mysql_func');
const { Newstosent } = require('./models/newstosent');
const index_router = require('./router/index_router');
const push_router = require('./router/push_router');
@@ -183,13 +184,13 @@ if (process.env.PROD !== 1) {
// testmsgwebpush();
// sendemail.testemail('2', 'it');
/*
/*
let crypt = tools.cryptdata('');
let decrypt = tools.decryptdata(crypt);
console.log('crypted:', crypt);
console.log('decrypted:', decrypt);
*/
*/
mycron();
}
@@ -228,13 +229,13 @@ function startserv() {
// Check if is Empty (new Server Data)
/*
/*
cfgserver.countDocuments(function (err, count) {
if (!err && count === 0) {
populateDBadmin();
}
});
*/
*/
}
@@ -273,6 +274,18 @@ cron.schedule('*/2 * * * *', () => {
mycron();
});
async function resetProcessingJob() {
arrrec = await Newstosent.find({});
for (const rec of arrrec) {
rec.processing_job = false;
await Newstosent.findOneAndUpdate({ _id: rec.id }, { $set: rec }, { new: false }).then((item) => {
});
}
}
//app.listen(port, () => {
// console.log(`Server started at port ${port}`);
//});
@@ -280,6 +293,14 @@ cron.schedule('*/2 * * * *', () => {
telegrambot.sendMsgTelegram('7', telegrambot.ADMIN_USER_SERVER, `Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
telegrambot.sendMsgTelegramByIdTelegram('7', telegrambot.ADMIN_IDTELEGRAM_SERVER, `Il Server ${process.env.DATABASE} è appena ripartito!`);
telegrambot.sendMsgTelegramByIdTelegram('2', telegrambot.ADMIN_IDTELEGRAM_SERVER, `Il Server ${process.env.DATABASE} è appena ripartito!`);
resetProcessingJob();
//
// telegrambot.sendMsgTelegramToTheManagers('7', 'PROVAAA!');
// if (process.env.PROD !== 1) {

View File

@@ -2,10 +2,14 @@ const tools = require('../tools/general');
const appTelegram = ['7'];
const appTelegramFinti = ['2'];
const appTelegramDest = ['7'];
const printf = require('util').format;
const { User } = require('../models/user');
const { CalZoom } = require('../models/calzoom');
const shared_consts = require('../tools/shared_nodejs');
const emoji = require('node-emoji');
@@ -16,6 +20,9 @@ const Benvenuto = emoji.get('heartbeat') + emoji.get('heartbeat') + emoji.get('h
const emo = {
STARS: emoji.get('stars'),
FIRE: emoji.get('fire'),
TV: emoji.get('tv'),
NEWSPAPER: emoji.get('newspaper'),
PENCIL: emoji.get('pencil2'),
DREAM: emoji.get('beach_with_umbrella'),
EYES: emoji.get('eyes'),
DIZZY: emoji.get('dizzy'),
@@ -73,6 +80,7 @@ const Menu = {
ADMIN: emoji.get('information_desk_person') + ' Admin',
ALTRO: emoji.get('newspaper') + ' Altro',
MSGATUTTI: emoji.get('incoming_envelope') + ' Invia a TUTTI',
MSGSTAFF: emoji.get('incoming_envelope') + ' Invia a STAFF',
INDIETRO: emoji.get('back') + ' Indietro',
SI: emoji.get('thumbsup') + ' SI',
NO: emoji.get('thumbsdown') + ' NO',
@@ -85,8 +93,8 @@ const MenuStandard = [[Menu.LAVAGNA, Menu.LINK_CONDIVIDERE], [Menu.ZOOM, Menu.AS
const MenuPerAdmin = [[Menu.LAVAGNA, Menu.LINK_CONDIVIDERE], [Menu.ZOOM, Menu.ASSISTENZA], [Menu.ADMIN, Menu.ALTRO]];
const MenuYesNo = [[Menu.SI, Menu.NO]];
const MenuAdmin = [[Menu.MSGATUTTI, Menu.INDIETRO], ['', '']];
const MenuYes = [[Menu.MSGATUTTI, Menu.INDIETRO], ['', '']];
const MenuAdmin = [[Menu.MSGSTAFF, Menu.MSGATUTTI, Menu.INDIETRO], ['', '']];
const MenuYes = [[Menu.MSGSTAFF, Menu.INDIETRO], ['', '']];
const Status = {
NONE: 0,
@@ -175,9 +183,11 @@ module.exports = {
if (usersmanagers) {
for (const rec of usersmanagers) {
this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + '[BOT-STAFF]' +emo.ADMIN + ': ' + text)
this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, emo.ROBOT_FACE + '[BOT-STAFF]' + emo.ADMIN + ': ' + text)
await tools.snooze(300)
}
}
return true
},
@@ -185,9 +195,10 @@ module.exports = {
const usersall = await User.getUsersTelegALL(idapp);
if (usersall) {
usersall.forEach((rec) => {
this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, text)
});
for (const rec of usersall) {
this.sendMsgTelegramByIdTelegram(idapp, rec.profile.teleg_id, text);
await tools.snooze(300)
}
}
},
@@ -277,6 +288,8 @@ class Telegram {
await this.menuAdmin(msg)
} else if (msg.text === Menu.MSGATUTTI) {
await this.menumsgAll(msg)
} else if (msg.text === Menu.MSGSTAFF) {
await this.menumsgStaff(msg)
} else if (msg.text === Menu.INDIETRO) {
await this.msgScegliMenu(msg);
} else {
@@ -332,6 +345,8 @@ class Telegram {
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 += '\n' + '\n' + this.getsymb(emo.PENCIL, tools.isBitActive(rec.user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_READ_GUIDELINES)) + tools.get__('LINEE_GUIDA', msg);
mystr += '\n' + '\n' + this.getsymb(emo.TV, tools.isBitActive(rec.user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI)) + tools.get__('VIDEO_INTRO', 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.DREAM, this.isdreamset(rec.user)) + tools.get__('SCRITTO_SOGNO', msg);
@@ -366,7 +381,6 @@ class Telegram {
mystr += '\n' + printf(tools.get__('INFO_LAVAGNA_SITO', msg), tools.getHostByIdApp(this.idapp));
}
if (!!mystr)
await this.sendMsg(msg.chat.id, mystr);
@@ -436,16 +450,7 @@ class Telegram {
}
await
this
.sendMsg(msg
.chat
.id
,
mystr
)
;
await this.sendMsg(msg.chat.id, mystr);
}
async menuAdmin(msg) {
@@ -459,6 +464,17 @@ class Telegram {
if (rec.user) {
const mystr = 'Scrivi qui un Messaggio da inviare a TUTTI:';
rec.msgall_status = StatusMSGALL.ASK;
rec.msgall_staff = false;
await this.sendMsg(msg.chat.id, mystr, MenuAdmin);
}
}
async menumsgStaff(msg) {
const rec = this.getRecInMem(msg);
if (rec.user) {
const mystr = 'Scrivi qui un Messaggio da inviare allo STAFF:';
rec.msgall_status = StatusMSGALL.ASK;
rec.msgall_staff = true;
await this.sendMsg(msg.chat.id, mystr, MenuAdmin);
}
}
@@ -596,7 +612,7 @@ class Telegram {
}
}
async sendMsgToAll(rec, msg, texttosend) {
async sendMsgToAll(rec, msg, texttosend, solostaff) {
if (texttosend.length < 3) {
} else {
const usersall = await
@@ -606,8 +622,15 @@ class Telegram {
if (usersall) {
for (const rec of usersall) {
let invia = true;
if (solostaff) {
invia = User.isManager(rec.perm)
}
if (invia) {
await this.sendMsg(rec.profile.teleg_id, texttosend);
nummsgsent++;
tools.snooze(300)
}
// ++Todo: SLEEP ??? sleep(0.03)
}
}
@@ -616,7 +639,6 @@ class Telegram {
this.sendMsg(msg.chat.id, nummsgsent + ' ' + getstr(msg.from.language_code, txt.MSG_MSG_SENT));
}
rec.start_write_msgall = false;
}
selectMenuHelp(msg) {
@@ -654,7 +676,7 @@ class Telegram {
if (msg.text === Menu.SI) {
// Take msg to send to ALL
await
this.sendMsgToAll(rec, msg, rec.msgtosent)
this.sendMsgToAll(rec, msg, rec.msgtosent, rec.msgall_staff)
} else {
this.sendMsg(msg.chat.id, txt.MSG_OPERAZ_ANNULLATA);
}
@@ -664,7 +686,10 @@ class Telegram {
if (msg.text !== Menu.INDIETRO) {
rec.msgtosent = msg.text;
rec.msgall_status = StatusMSGALL.CONFIRM;
const domanda = 'Confermi d\'Inviare questo messaggio a TUTTI ?\n' + rec.msgtosent;
let achi = "TUTTI";
if (rec.msgall_staff)
achi = "STAFF";
const domanda = 'Confermi d\'Inviare questo messaggio a ' + achi + ' ?\n' + rec.msgtosent;
this.ChiediSINO(msg, domanda);
} else {
rec.msgall_status = StatusMSGALL.NONE;
@@ -834,6 +859,14 @@ function getclTelegBytoken(token) {
}
function getclTelegByidapp(idapp) {
// ****************************
if (appTelegramFinti.includes(idapp)) {
const ind = appTelegramFinti.indexOf(idapp);
if (ind >= 0)
idapp = appTelegramDest[ind]; // Invia
}
const rec = arrTelegram.find((rec) => rec.idapp === idapp);
if (!!rec)
return rec.cl;

View File

@@ -12,7 +12,7 @@ const Url = require('url-parse');
const { ObjectID } = require('mongodb');
const shared_consts = require('../tools/shared_nodejs');
const shared_consts = require('./shared_nodejs');
const mongoose = require('mongoose');
const Subscription = mongoose.model('subscribers');
@@ -56,6 +56,8 @@ textlang = {
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno',
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato',
'NONREG': 'Invitati non Registrati',
@@ -77,6 +79,8 @@ textlang = {
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno',
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato',
'NONREG': 'Invitati non Registrati',
@@ -94,6 +98,8 @@ textlang = {
'TELEGRAM_NOT_CONNECTED': "Telegram non associato al tuo account!",
'NESSUN_INVITATO': 'Non hai invitato nessuno',
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'LINEE_GUIDA': 'Accettato le Linee Guida',
'VIDEO_INTRO': 'Visto il Video di AYNI',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato',
'NONREG': 'Invitati non Registrati',
@@ -488,6 +494,14 @@ module.exports = {
return '';
},
getpathregByIdApp: function (idapp, lang) {
const myapp = MYAPPS.find((item) => item.idapp === idapp);
if (myapp)
return 'registration' + myapp.pathreg_add + '/' + lang;
else
return '';
},
isManagAndAdminDifferent(idapp) {
const manag = this.getManagerEmailByIdApp(idapp);
return (manag !== this.getAdminEmailByIdApp(idapp)) && (manag !== '');

View File

@@ -1,4 +1,11 @@
module.exports = {
Accepted: {
CHECK_READ_GUIDELINES: 1,
CHECK_SEE_VIDEO_PRINCIPI: 2,
},
ALL_SAW_AND_ACCEPTED: 3,
// ---------------------
FILTER_EXTRALIST_NOT_REGISTERED: 1,
FILTER_EXTRALIST_NOT_CONTACTED: 2,
@@ -23,7 +30,7 @@ module.exports = {
},
fieldsUserToChange() {
return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'date_temp_reg', 'verified_email', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift', 'ind_order']
return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'date_temp_reg', 'verified_email', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift', 'ind_order', 'numinvitati', 'numinvitatiattivi']
}
};