- aggiornati form registrazione
- Login - Password dimenticata - Aggiorna password. - Email registrazione - Ammetti Utente
This commit is contained in:
@@ -498,9 +498,16 @@ module.exports = {
|
||||
const strlinkreg = tools.getHostByIdApp(idapp) + `/invitetoreg/${dati.token}`;
|
||||
return strlinkreg;
|
||||
},
|
||||
getLinkAmmissione: function (idapp, user) {
|
||||
if (user.token_da_ammettere) {
|
||||
const strlink = tools.getHostByIdApp(idapp) + `/ammetti/${user.token_da_ammettere}/${user.username}`;
|
||||
return strlink;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
getPathEmail(idapp, email_template) {
|
||||
const RISO_TEMPLATES = ['reg_notifica_all_invitante', 'reg_email_benvenuto_ammesso'];
|
||||
const RISO_TEMPLATES = ['reg_notifica_all_invitante', 'reg_email_benvenuto_ammesso', 'reg_chiedi_ammettere_all_invitante'];
|
||||
|
||||
if (idapp === '13') {
|
||||
if (RISO_TEMPLATES.includes(email_template)) {
|
||||
@@ -513,6 +520,14 @@ module.exports = {
|
||||
try {
|
||||
const nomecognomeInvitante = await User.getNameSurnameByUsername(idapp, user.aportador_solidario, true);
|
||||
|
||||
if (!user.verified_by_aportador) {
|
||||
// Genera Token per Ammettere l'Utente
|
||||
const r1 = await User.setAmmissioneByTokenAndUsername(idapp, user.username);
|
||||
if (r1 && r1.token_da_ammettere) {
|
||||
user.token_da_ammettere = r1.token_da_ammettere;
|
||||
}
|
||||
}
|
||||
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: await this.getdataemail(idapp),
|
||||
@@ -522,6 +537,7 @@ module.exports = {
|
||||
strlinksito: tools.getHostByIdApp(idapp),
|
||||
strlinkreg: this.getlinkReg(idapp, idreg),
|
||||
forgetpwd: tools.getHostByIdApp(idapp) + '/requestresetpwd',
|
||||
linkAmmissione: this.getLinkAmmissione(idapp, user),
|
||||
emailto: emailto,
|
||||
verified_email: user.verified_email,
|
||||
usernameInvitante: user.aportador_solidario,
|
||||
@@ -547,7 +563,7 @@ module.exports = {
|
||||
//Invia una email al nuovo utente
|
||||
await this.sendEmail_base(quale_email_inviare, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
if (user.verified_email && user.aportador_solidario) {
|
||||
if (user.verified_email && user.aportador_solidario && user.verified_by_aportador) {
|
||||
const pathemail = this.getPathEmail(idapp, 'reg_notifica_all_invitante');
|
||||
|
||||
// Manda anche una email al suo Invitante
|
||||
@@ -558,6 +574,17 @@ module.exports = {
|
||||
mylocalsconf,
|
||||
''
|
||||
);
|
||||
} else if (user.aportador_solidario && !user.verified_by_aportador) {
|
||||
const pathemail = this.getPathEmail(idapp, 'reg_chiedi_ammettere_all_invitante');
|
||||
|
||||
// Manda una email al suo Invitante per chiedere di essere ammesso
|
||||
const recaportador = await User.getUserShortDataByUsername(idapp, user.aportador_solidario);
|
||||
const ris = await this.sendEmail_base(
|
||||
pathemail + '/' + tools.LANGADMIN,
|
||||
recaportador.email,
|
||||
mylocalsconf,
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
// Send to the Admin an Email
|
||||
@@ -626,15 +653,18 @@ module.exports = {
|
||||
emailto: emailto,
|
||||
usernameInvitante: dati.usernameInvitante,
|
||||
ammessoUtente: true,
|
||||
user,
|
||||
};
|
||||
|
||||
const ris = await this.sendEmail_base('reg_email_benvenuto_ammesso/' + lang, emailto, mylocalsconf, '');
|
||||
const quale_email_inviare = this.getPathEmail(idapp, 'reg_email_benvenuto_ammesso') + '/' + lang;
|
||||
|
||||
const ris = await this.sendEmail_base(quale_email_inviare, emailto, mylocalsconf, '');
|
||||
|
||||
await telegrambot.notifyToTelegram(telegrambot.phase.AMMETTI_UTENTE, mylocalsconf);
|
||||
|
||||
return ris;
|
||||
} catch (e) {
|
||||
console.error('Err sendEmail_InvitaAmico', e);
|
||||
console.error('Err sendEmail_Utente_Ammesso', e);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user