- Downline User

- Not registered if already exists.
- Forgot Password
This commit is contained in:
Paolo Arena
2020-01-30 01:19:25 +01:00
parent 25ad3e91c2
commit 512a8c14e2
12 changed files with 551 additions and 44 deletions

View File

@@ -1,2 +1,346 @@
.provared { /* Default CSS */
color: red; } body, #body_style {
margin: 0;
padding: 0;
background: #E9F2F9;
color: #5b656e; }
a {
color: #09c; }
a img {
border: none;
text-decoration: none; }
table, table td {
border-collapse: collapse; }
td, h1, h2, h3, p {
font-family: tahoma, geneva, sans-serif;
color: #313a42; }
h1, h2, h3, h4 {
color: #313a42 !important;
font-weight: normal;
line-height: 1.2; }
h1 {
font-size: 24px; }
h2 {
font-size: 18px; }
h3 {
font-size: 16px; }
p {
margin: 0 0 0.4em 0; }
/* Force Outlook to provide a "view in browser" menu link. */
#outlook a {
padding: 0; }
/* Preheader and webversion */
.preheader {
background-color: #8bafcb; }
.preheaderContent, .webversion, .webversion a {
color: #ffffff;
font-size: 10px; }
.preheaderContent {
width: 440px; }
.preheaderContent, .webversion {
padding: 5px 10px; }
.webversion {
width: 200px;
text-align: center; }
.webversion a {
text-decoration: underline;
color: #ffffff;
font-size: 10px; }
/* Logo (branding) */
.logoContainer {
padding: 20px 0 10px 0px;
width: 320px;
text-align: center; }
.myimg {
padding: 20px;
max-width: 250px;
float: left;
text-align: center; }
.logoContainer a {
color: #ffffff; }
/* Whitespace (imageless spacer) */
.whitespace {
line-height: 0; }
.firma {
font-size: 0.75rem; }
.disclaimer {
padding: 10px;
background-color: #ffffff;
font-size: 0.75rem;
color: gray;
line-height: 130%; }
.bottom {
padding: 10px;
margin-top: 20px;
background-color: #ffffff;
border-top: 1px solid #e5e5e5;
text-align: center;
font-size: 0.75rem;
color: #606060;
line-height: 150%; }
/* Button */
.buttonContainer {
padding: 0px 0px 0px 0px; }
.button, .button2 {
text-align: center;
border: 1px solid #f75666;
border-radius: 10px; }
.button a, .button2 a {
color: #f75666;
text-decoration: none;
display: block;
font-size: 13px; }
.button2 {
border: 1px solid #0000ff; }
.button2 a {
font-size: 1.15rem;
color: #0000ff; }
.center_img {
display: block !important;
margin-left: auto;
margin-right: auto; }
/* Complete email content */
.emailContainer {
padding: 40px 20px 10px 20px;
background: #ffffff;
border-radius: 4px; }
.textIniContainer {
padding: 20px 20px 20px 20px;
background: #ffffff;
border-radius: 10px; }
.discContainer {
padding: 40px 20px 10px 20px;
background: #ffffff;
border-radius: 4px; }
/* An article */
.sectionMainTitle {
color: #5b656e; }
.sectionContentTitle, .sectionContent, .sectionContentSubTitle {
padding: 0px 5px 0px 0px; }
.teacher {
font-style: italic;
margin-top: 16px;
text-align: center;
font-size: .75rem; }
.contrib {
font-size: .75rem;
font-style: italic;
font-weight: bold; }
.sectionContentTitle {
font-weight: bold;
text-shadow: .05rem .05rem .05rem #555;
font-size: 18px;
color: blue;
padding: 0px 0px 5px 0; }
.sectionContentSubTitle {
font-size: 12px;
color: #0000ff;
text-transform: uppercase;
padding: 0px 0px 5px 0px; }
.LinkDisc a {
text-decoration: none; }
.pDisc:hover {
color: white !important;
background: #5c8ef4 !important; }
.hoverLink a:hover {
color: white !important;
background: #5c8ef4 !important; }
.hoverLink a {
padding: 5px;
border-radius: 10px; }
.sectionContent {
font-size: 13px;
line-height: 18px; }
.center {
text-align: center; }
.testomail {
padding: 10px;
font-size: 0.75rem; }
.clpromo {
background-color: orange;
text-align: center;
font-size: 1rem; }
.sectionArticleImage {
padding: 0px 15px 0px 0px;
text-align: center; }
.sectionArticleImage img {
padding: 0px 0px 0px 0px;
-ms-interpolation-mode: bicubic;
display: block;
border: 1px solid #5b656e; }
/* Footer and social media */
.footNotes {
padding: 0px 20px 0px 20px; }
.footLink {
padding: 0px 5px 0px 5px; }
.footNotes a {
color: #ffffff;
font-size: 13px; }
.socialMedia {
background: #8bafcb; }
/* Column */
.column {
padding-bottom: 20px; }
/* CSS for specific screen width(s) */
@media only screen and (max-width: 480px) {
body, table, td, p, a, li, blockquote {
-webkit-text-size-adjust: none !important; }
body[yahoofix] table {
width: 100% !important; }
body[yahoofix] .webversion {
display: none;
font-size: 0;
max-height: 0;
line-height: 0;
mso-hide: all; }
body[yahoofix] .logoContainer {
text-align: center; }
body[yahoofix] .sectionContentTitle, body[yahoofix] .sectionContentSubTitle, body[yahoofix] .sectionContent {
text-align: center;
padding: 0 5px 10px 5px; }
body[yahoofix] .sectionArticleImage {
padding-right: 0px !important; }
body[yahoofix] .sectionArticleImage img {
margin: 0 auto; }
body[yahoofix] .sectionPadding {
padding: 0px 10px 0px 10px; }
body[yahoofix] .buttonContainer {
padding: 0px 0px 0px 00px; }
body[yahoofix] .column {
float: left;
width: 100%;
margin: 0px 0px 30px 0px;
padding-bottom: 0px !important; } }
.boldhigh, .boldop, .text-big {
font-weight: bold;
text-shadow: .06125rem .06125rem .125rem #555; }
.row.inline, .column.inline, .flex.inline {
display: inline-flex; }
.cltexth3, .cltexth2, .cltexth4, .cltexth5 {
font-size: 1.25rem;
font-weight: 400;
line-height: 1.75rem;
letter-spacing: .01em;
text-align: center !important; }
.cltexth4 {
font-size: 1rem !important;
line-height: 1rem !important; }
.cltitle_disc {
text-align: center;
padding: 0.55rem;
font-size: 1.25rem !important;
color: #ff1838 !important;
font-weight: bold !important; }
.cltexth5 {
line-height: 0.75rem !important; }
.text-right {
text-align: right; }
.glossy {
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.12) 51%, rgba(0, 0, 0, 0.04)) !important; }
.items-center, .flex-center {
align-items: center; }
.no-wrap {
flex-wrap: nowrap; }
.row, .flex {
display: flex;
flex-wrap: wrap; }
.shadow-5 {
box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 5px 8px rgba(0, 0, 0, 0.14), 0 1px 14px rgba(0, 0, 0, 0.12); }
.bg-red {
background: #f44336 !important; }
.bg-blue {
background: #5c8ef4 !important; }
.bg-white {
background: #ffffff !important; }
.text-white {
color: #fff !important; }
.q-chip--dense {
border-radius: 12px;
padding: 0 0.4em;
height: 1.5em; }
.q-chip, .q-chip2 {
vertical-align: middle;
border-radius: 16px;
outline: 0;
position: relative;
height: 1em;
margin: 4px;
background: #e0e0e0;
color: rgba(0, 0, 0, 0.87);
font-size: 0.75rem;
padding: 0.5em 0.9em; }
.q-chip2 {
height: 2em; }

View File

@@ -1,2 +1,5 @@
html { body {
background: #0f91b5; } background: #000000; }
.sfondotab {
background-color: orange; }

View File

@@ -5,8 +5,9 @@ var file = `.env.${node_env}`;
// GLOBALI (Uguali per TUTTI) // GLOBALI (Uguali per TUTTI)
process.env.LINKVERIF_REG = '/vreg'; process.env.LINKVERIF_REG = '/vreg';
process.env.LINK_REQUEST_NEWPASSWORD = '/requestnewpwd'; process.env.LINK_REQUEST_NEWPASSWORD = '/requestnewpwd';
process.env.LINK_UPDATE_PASSWORD = '/updatepassword';
process.env.LINK_UPDATE_PWD = '/updatepwd';
process.env.LINK_CHECK_UPDATES = '/checkupdates'; process.env.LINK_CHECK_UPDATES = '/checkupdates';
process.env.LINK_UPDATE_PASSWORD = '/updatepwd';
process.env.KEY_APP_ID = 'KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF'; process.env.KEY_APP_ID = 'KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF';
console.log("FILE : " + file); console.log("FILE : " + file);

View File

@@ -167,6 +167,28 @@ ExtraListSchema.statics.getUsersList = function (idapp) {
}; };
ExtraListSchema.statics.getDownlineNotRegisteredByNameSurname = function (idapp, nameandsurname) {
const ExtraList = this;
return ExtraList.find({
'aportador_solidario_name_surname': nameandsurname,
registered: false,
}, {
username: 1,
name: 1,
surname: 1,
verified_email: 1,
'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1,
made_gift: 1,
email: 1,
date_reg: 1,
img: 1
}, (err, arrrec) => {
return arrrec
});
};
ExtraListSchema.statics.getFieldsForSearch = function () { ExtraListSchema.statics.getFieldsForSearch = function () {
return ['username', 'name', 'surname', 'cell_complete', 'aportador_solidario_name_surname', 'aportador_solidario_originale_name_surname'] return ['username', 'name', 'surname', 'cell_complete', 'aportador_solidario_name_surname', 'aportador_solidario_originale_name_surname']

View File

@@ -332,6 +332,8 @@ UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
name: 1, name: 1,
surname: 1, surname: 1,
verified_email: 1, verified_email: 1,
'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1,
made_gift: 1, made_gift: 1,
email: 1, email: 1,
date_reg: 1, date_reg: 1,
@@ -357,6 +359,8 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
name: 1, name: 1,
surname: 1, surname: 1,
verified_email: 1, verified_email: 1,
'profile.teleg_id': 1,
'profile.saw_zoom_presentation': 1,
made_gift: 1, made_gift: 1,
email: 1, email: 1,
date_reg: 1, date_reg: 1,
@@ -366,17 +370,44 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
}); });
}; };
UserSchema.statics.getnumInvitatiAttivi = function (idapp, username) { UserSchema.statics.getnumInvitatiAttivi = function (idapp, username) {
const User = this; const User = this;
return User.count({ return User.count({
idapp, idapp,
aportador_solidario: username, aportador_solidario: username,
teleg_id: { $gt: 1 }, 'profile.teleg_id': { $gt: 1 },
saw_zoom_presentation: true, 'profile.saw_zoom_presentation': true,
}); });
}; };
UserSchema.statics.getUsersNationalityQuery = function (idapp) {
const query = [
{
$match: { idapp }
},
{
$group: { _id: "$profile.nationality", count: { $sum: 1 } }
},
{
$sort: { count: -1 }
}
];
return query
};
UserSchema.statics.getindOrderDuplicate = function (idapp) {
const User = this;
return User.aggregate(User.getUsersNationalityQuery(idapp))
.then(ris => {
// console.table(ris);
return JSON.stringify(ris);
});
};
UserSchema.statics.getnumInvitati = function (idapp, username) { UserSchema.statics.getnumInvitati = function (idapp, username) {
const User = this; const User = this;
@@ -462,6 +493,17 @@ UserSchema.statics.getEmailByUsername = async function (idapp, username) {
}); });
}; };
UserSchema.statics.getAportadorSolidarioByUsername = async function (idapp, username) {
const User = this;
return await User.findOne({ idapp, username })
.then((rec) => {
return ((rec) ? rec.aportador_solidario : '');
}).catch((e) => {
console.error('getAportadorSolidarioByUsername', e);
});
};
UserSchema.statics.UserByIdTelegram = async function (idapp, teleg_id) { UserSchema.statics.UserByIdTelegram = async function (idapp, teleg_id) {
const User = this; const User = this;
@@ -671,10 +713,18 @@ UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, us
dashboard.aportador = await User.getUserShortDataByUsername(idapp, aportador_solidario); dashboard.aportador = await User.getUserShortDataByUsername(idapp, aportador_solidario);
// Data of my Downline // Data of my Downline
dashboard.downline = await User.getDownlineByUsername(idapp, username); const arrap = await User.getDownlineByUsername(idapp, aportador_solidario);
dashboard.numpeople_aportador = arrap.length;
for (let index = 0; index < dashboard.downline.length; ++index) { dashboard.downline = await User.getDownlineByUsername(idapp, username);
dashboard.downline[index].downline = await User.getDownlineByUsername(idapp, dashboard.downline[index].username); dashboard.downbyuser = {};
for (const down of dashboard.downline) {
dashboard.downbyuser[down.username] = await User.getDownlineByUsername(idapp, down.username);
for (const down2 of dashboard.downbyuser[down.username]) {
dashboard.downbyuser[down2.username] = await User.getDownlineByUsername(idapp, down2.username);
}
} }
return dashboard; return dashboard;
} catch (e) { } catch (e) {
@@ -701,6 +751,18 @@ UserSchema.statics.fixUsername = async function (idapp, aportador_solidario_ind_
}; };
UserSchema.statics.findByCellAndNameSurname = function (idapp, cell, name, surname) {
const User = this;
return User.findOne({
'idapp': idapp,
'profile.cell': cell,
'name': name,
'surname': surname,
});
};
UserSchema.statics.getUsersRegistered = async function (idapp) { UserSchema.statics.getUsersRegistered = async function (idapp) {
const User = this; const User = this;
@@ -788,7 +850,7 @@ UserSchema.statics.calculateStat = async function (idapp, username) {
}; };
UserSchema.statics.getUsersNationalityQuery = function (idapp) { UserSchema.statics.getDistinctNationalityQuery = function (idapp) {
const query = [ const query = [
{ {
$match: { idapp } $match: { idapp }
@@ -807,7 +869,7 @@ UserSchema.statics.getUsersNationalityQuery = function (idapp) {
UserSchema.statics.findAllDistinctNationality = async function (idapp) { UserSchema.statics.findAllDistinctNationality = async function (idapp) {
const User = this; const User = this;
return User.aggregate(User.getUsersNationalityQuery(idapp)) return User.aggregate(User.getDistinctNationalityQuery(idapp))
.then(ris => { .then(ris => {
// console.table(ris); // console.table(ris);
return JSON.stringify(ris); return JSON.stringify(ris);
@@ -852,6 +914,29 @@ if (tools.INITDB_FIRSTIME) {
// UserSchema.index({ surname: 1 }); // UserSchema.index({ surname: 1 });
} }
UserSchema.statics.DbOp = async function (idapp, mydata) {
const User = this;
try {
if (mydata.dbop === 'changeCellInt') {
arrusers = await User.find({ 'idapp': idapp });
let num = 0;
for (const rec of arrusers) {
let mycell = tools.removespaces(rec.profile.intcode_cell + rec.profile.cell);
await User.findOneAndUpdate({ _id: rec._id }, { $set: { 'profile.cell': mycell } })
num++;
}
return { num };
// return await User.updateMany({ idapp }, { $set: { 'profile.cell': { $concat: ["$profile.intcode_cell", "$profile.cell"] } } })
}
} catch (e) {
console.error(e);
}
};
const User = mongoose.model('User', UserSchema); const User = mongoose.model('User', UserSchema);

View File

@@ -18,10 +18,21 @@ const { ObjectID } = require('mongodb');
router.post('/', authenticate, async (req, res) => { router.post('/', authenticate, async (req, res) => {
const idapp = req.body.idapp; const idapp = req.body.idapp;
let username = req.body.username;
const aportador_solidario = req.user.aportador_solidario; if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm)) && (username) !== req.user.username) {
// If without permissions, exit
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
}
let aportador_solidario = req.user.aportador_solidario;
const dashboard = await User.getDashboard(idapp, aportador_solidario, req.user.username); if (username) {
aportador_solidario = await User.getAportadorSolidarioByUsername(idapp, username)
} else {
username = req.user.username;
}
const dashboard = await User.getDashboard(idapp, aportador_solidario, username);
if (dashboard) if (dashboard)
res.send({ dashboard }); res.send({ dashboard });
else else

View File

@@ -5,6 +5,8 @@ const router = express.Router(),
const jwt = require('jsonwebtoken'); const jwt = require('jsonwebtoken');
const telegrambot = require('../telegram/telegrambot');
const sendemail = require('../sendemail'); const sendemail = require('../sendemail');
const { authenticate, authenticate_noerror } = require('../middleware/authenticate'); const { authenticate, authenticate_noerror } = require('../middleware/authenticate');
@@ -94,8 +96,9 @@ router.post(process.env.LINK_REQUEST_NEWPASSWORD, (req, res) => {
const email = body.email; const email = body.email;
console.log("POST " + process.env.LINK_REQUEST_NEWPASSWORD + " idapp= " + idapp + " email = " + email); console.log("POST " + process.env.LINK_REQUEST_NEWPASSWORD + " idapp= " + idapp + " email = " + email);
User.findByEmail(idapp, email).then((user) => { User.findByEmail(idapp, email).then(async (user) => {
if (!user) { if (!user) {
await tools.snooze(5000);
return res.status(200).send({ code: server_constants.RIS_CODE_EMAIL_NOT_EXIST, msg: '' }); return res.status(200).send({ code: server_constants.RIS_CODE_EMAIL_NOT_EXIST, msg: '' });
} else { } else {
// Creo il tokenforgot // Creo il tokenforgot
@@ -118,17 +121,20 @@ router.post(process.env.LINK_REQUEST_NEWPASSWORD, (req, res) => {
// Invio la Nuova Password richiesta dal reset! // Invio la Nuova Password richiesta dal reset!
// Ritorna il token per poter effettuare le chiamate... // Ritorna il token per poter effettuare le chiamate...
router.post(process.env.LINK_UPDATE_PASSWORD, (req, res) => { router.post(process.env.LINK_UPDATE_PWD, (req, res) => {
var body = _.pick(req.body, ['idapp', 'email', 'tokenforgot', 'password']); const body = _.pick(req.body, ['idapp', 'email', 'tokenforgot', 'password']);
var idapp = body.idapp; const idapp = body.idapp;
var email = body.email; const email = body.email;
var tokenforgot = body.tokenforgot; const tokenforgot = body.tokenforgot;
var password = body.password; const password = body.password;
console.log("POST " + process.env.LINK_UPDATE_PASSWORD + " idapp= " + idapp + " email = " + email + " tokenforgot = " + tokenforgot); const msg = "Richiesta Nuova Password: idapp= " + idapp + " email = " + email;
console.log(msg);
telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
User.findByLinkTokenforgot(idapp, email, tokenforgot).then((user) => { User.findByLinkTokenforgot(idapp, email, tokenforgot).then((user) => {
if (!user) { if (!user) {
return res.status(404).send(); 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;
@@ -140,7 +146,7 @@ router.post(process.env.LINK_UPDATE_PASSWORD, (req, res) => {
// Salva lo User // Salva lo User
user.save().then(() => { user.save().then(() => {
res.header('x-auth', token).send({ user }); // Ritorna il token di ritorno res.header('x-auth', token).send({code: server_constants.RIS_CODE_OK}); // Ritorna il token di ritorno
}); });
}) })
} }

View File

@@ -62,11 +62,11 @@ router.post('/', async (req, res) => {
user.verified_email = true; user.verified_email = true;
} }
if (user.profile.intcode_cell) { // if (user.profile.intcode_cell) {
if (user.profile.cell.substring(0, user.profile.intcode_cell.length) === 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) // user.profile.cell = user.profile.cell.substring(user.profile.intcode_cell.length)
} // }
} // }
let exit; let exit;
// Check if already esist email or username // Check if already esist email or username
@@ -93,9 +93,18 @@ router.post('/', async (req, res) => {
if (exit === 1) if (exit === 1)
return; return;
let recuser = null;
recuser = await User.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name, user.surname);
if (recuser) {
// User already registered!
res.status(400).send({ code: server_constants.RIS_CODE_USER_ALREADY_EXIST, msg: '' });
return 1;
}
let recextra = null; let recextra = null;
recextra = await ExtraList.findByCellAndNameSurname(user.idapp, getMobileComplete(user), user.name, user.surname); recextra = await ExtraList.findByCellAndNameSurname(user.idapp, user.profile.cell, user.name, user.surname);
let nomeaportador_corretto = ""; let nomeaportador_corretto = "";
if (recextra) { if (recextra) {
nomeaportador_corretto = recextra.aportador_solidario_name_surname; nomeaportador_corretto = recextra.aportador_solidario_name_surname;
@@ -103,6 +112,9 @@ router.post('/', async (req, res) => {
nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname; nomeaportador_corretto = recextra.aportador_solidario_originale_name_surname;
} }
const lastuser = await User.getLastUser(user.idapp); const lastuser = await User.getLastUser(user.idapp);
const lastextra = await ExtraList.getLastUser(user.idapp); const lastextra = await ExtraList.getLastUser(user.idapp);
let lastindorder = 0; let lastindorder = 0;
@@ -139,10 +151,10 @@ router.post('/', async (req, res) => {
if (already_registered) { if (already_registered) {
// Check in the extraList if is present! // Check in the extraList if is present!
if (!recextra) { if (!recextra) {
console.log('Utente non trovato; ', user); const msg = 'Utente non trovato: ' + user.name + ' ' + user.surname + ' ' + user.profile.nationality + ' ' + user.profile.cell + ' email: ' + user.email + ' username: ' + user.username;
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; console.log('Utente non trovato; ', msg);
telegrambot.sendMsgTelegramToTheManagers(user.idapp, msg); telegrambot.sendMsgTelegramToTheManagers(user.idapp, msg);
res.status(400).send({ code: server_constants.RIS_CODE_USER_EXTRALIST_NOTFOUND, msg: '' }); res.status(400).send({ code: server_constants.RIS_CODE_USER_EXTRALIST_NOTFOUND, msg: 'Controlla se il numero ' + user.profile.cell + ' è corretto.' });
return 1; return 1;
} else { } else {
user.ind_order = recextra.ind_order; user.ind_order = recextra.ind_order;
@@ -267,11 +279,12 @@ router.post('/login', (req, res) => {
let resalreadysent = false; let resalreadysent = false;
User.findByCredentials(user.idapp, user.username, user.password) User.findByCredentials(user.idapp, user.username, user.password)
.then((user) => { .then(async (user) => {
// tools.mylog("CREDENZIALI ! "); // tools.mylog("CREDENZIALI ! ");
if (!user) { if (!user) {
tools.mylogshow("Errore LOGIN ! Username o password Errati: ", body.username, body.password); await tools.snooze(3000);
const msg = "Tentativo di Login ERRATO [" + body.username + ' , ' + body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) + ']'; const msg = "Tentativo di Login ERRATO [" + body.username + ' , ' + body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) + ']';
tools.mylogshow(msg);
telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg); telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR }); res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR });
} }
@@ -363,5 +376,17 @@ router.post('/import_extralist', async (req, res) => {
res.send(ris); res.send(ris);
}); });
router.post('/dbop', async (req, res) => {
const mydata = req.body.mydata;
idapp = req.body.idapp;
locale = req.body.locale;
const ris = await User.DbOp(idapp, mydata);
console.log('ris', ris);
res.send(ris);
});
module.exports = router; module.exports = router;

View File

@@ -147,8 +147,8 @@ module.exports = {
strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `?idapp=${idapp}&idlink=${idreg}`; strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `?idapp=${idapp}&idlink=${idreg}`;
return strlinkreg; return strlinkreg;
}, },
getlinkRequestNewPassword: function (idapp, username, tokenforgot) { getlinkRequestNewPassword: function (idapp, email, tokenforgot) {
strlinkreg = tools.getHostByIdApp(idapp) + "/#" + process.env.LINK_REQUEST_NEWPASSWORD + `?idapp=${idapp}&username=${username}&=tokenforgot=${tokenforgot}`; strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD + `?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`;
return strlinkreg; return strlinkreg;
}, },
sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) { sendEmail_Registration: async function (lang, emailto, user, idapp, idreg) {
@@ -191,7 +191,7 @@ module.exports = {
name: user.name, name: user.name,
username: user.username, username: user.username,
surname: user.surname, surname: user.surname,
strlinksetpassword: this.getlinkRequestNewPassword(idapp, user.username, tokenforgot), strlinksetpassword: this.getlinkRequestNewPassword(idapp, emailto, tokenforgot),
emailto: emailto, emailto: emailto,
}; };

View File

@@ -66,7 +66,7 @@ const Menu = {
LINK_CONDIVIDERE: emoji.get('link') + ' Link da condividere', LINK_CONDIVIDERE: emoji.get('link') + ' Link da condividere',
ZOOM: emoji.get('information_source') + ' Zoom (Conferenze)', ZOOM: emoji.get('information_source') + ' Zoom (Conferenze)',
INFO: emoji.get('information_source') + ' Informazioni', INFO: emoji.get('information_source') + ' Informazioni',
ASSISTENZA: emoji.get('open_hands') + ' Assistenza', ASSISTENZA: emoji.get('open_hands') + ' Chat e Assistenza',
ADMIN: emoji.get('information_desk_person') + ' Admin', ADMIN: emoji.get('information_desk_person') + ' Admin',
ALTRO: emoji.get('newspaper') + ' Altro', ALTRO: emoji.get('newspaper') + ' Altro',

View File

@@ -43,7 +43,7 @@ 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': "Chat d'Aiuto e Supporto: 'AYNI Help & Support'\nEntra in questa chat:\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\n\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 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità." ,
'BENVENUTO': "Benvenuto", 'BENVENUTO': "Benvenuto",
'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\"**",
@@ -59,7 +59,7 @@ 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': "Chat d'Aiuto e Supporto: 'AYNI Help & Support'\nEntra in questa chat:\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\n\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 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità." ,
'BENVENUTO': "Benvenuto", 'BENVENUTO': "Benvenuto",
'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\"**",
@@ -71,7 +71,7 @@ textlang = {
}, },
us: { us: {
"partecipanti": "participants", "partecipanti": "participants",
'TESTO_ASSISTENZA': "Chat d'Aiuto e Supporto: 'AYNI Help & Support'\nEntra in questa chat:\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\n\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 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità." ,
'BENVENUTO': "Benvenuto", 'BENVENUTO': "Benvenuto",
'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\"**",
@@ -545,6 +545,10 @@ module.exports = {
query.push(mysort) query.push(mysort)
} }
let numrowend = params.endRow - params.startRow;
if (numrowend < 0)
numrowend = 1;
query.push( query.push(
{ {
$group: { $group: {
@@ -559,7 +563,7 @@ module.exports = {
{ {
$project: { $project: {
count: 1, count: 1,
rows: { $slice: ['$results', params.startRow, params.endRow - params.startRow] } rows: { $slice: ['$results', params.startRow, numrowend] }
} }
} }
); );
@@ -845,6 +849,10 @@ module.exports = {
} catch (e) { } catch (e) {
return '' return ''
} }
} },
removespaces(mystr) {
return mystr.replace(/\s+/g, '')
},
}; };

View File

@@ -10,6 +10,7 @@ module.exports = Object.freeze({
RIS_CODE_USER_EXTRALIST_NOTFOUND: -70, RIS_CODE_USER_EXTRALIST_NOTFOUND: -70,
RIS_CODE_USERNAME_ALREADY_EXIST: -60, RIS_CODE_USERNAME_ALREADY_EXIST: -60,
RIS_CODE_EMAIL_ALREADY_EXIST: -50, RIS_CODE_EMAIL_ALREADY_EXIST: -50,
RIS_CODE_USER_ALREADY_EXIST: -48,
RIS_CODE_EMAIL_NOT_EXIST: -45, RIS_CODE_EMAIL_NOT_EXIST: -45,
RIS_CODE_EMAIL_NOT_SENT: -40, RIS_CODE_EMAIL_NOT_SENT: -40,
RIS_CODE_ERR_UNAUTHORIZED: -30, RIS_CODE_ERR_UNAUTHORIZED: -30,
@@ -20,6 +21,7 @@ module.exports = Object.freeze({
RIS_CODE_LOGIN_OK: 1, RIS_CODE_LOGIN_OK: 1,
RIS_CODE_HTTP_INVALID_TOKEN: 403, RIS_CODE_HTTP_INVALID_TOKEN: 403,
RIS_CODE_TOKEN_RESETPASSWORD_NOT_FOUND: -23,
RIS_SUBSCRIBED_OK: 1, RIS_SUBSCRIBED_OK: 1,
RIS_SUBSCRIBED_ALREADYEXIST: 2, RIS_SUBSCRIBED_ALREADYEXIST: 2,