fix order non si vedeva.. e msg login errato
This commit is contained in:
@@ -5013,9 +5013,10 @@ UserSchema.statics.getExtraInfoByUsername = async function (idapp, username) {
|
|||||||
let myuser = await User.findOne({ idapp, username }).lean();
|
let myuser = await User.findOne({ idapp, username }).lean();
|
||||||
if (myuser) {
|
if (myuser) {
|
||||||
myuserextra = await User.addExtraInfo(idapp, myuser, null);
|
myuserextra = await User.addExtraInfo(idapp, myuser, null);
|
||||||
|
return myuser.profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
return myuser.profile;
|
return null;
|
||||||
|
|
||||||
};
|
};
|
||||||
UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, version) {
|
UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, version) {
|
||||||
|
|||||||
@@ -568,6 +568,8 @@ router.post('/login', (req, res) => {
|
|||||||
|
|
||||||
let resalreadysent = false;
|
let resalreadysent = false;
|
||||||
|
|
||||||
|
const myuser = user;
|
||||||
|
|
||||||
User.findByCredentials(user.idapp, user.username, user.password).
|
User.findByCredentials(user.idapp, user.username, user.password).
|
||||||
then(async (user) => {
|
then(async (user) => {
|
||||||
// tools.mylog("CREDENZIALI ! ");
|
// tools.mylog("CREDENZIALI ! ");
|
||||||
@@ -576,7 +578,7 @@ router.post('/login', (req, res) => {
|
|||||||
const msg = 'Tentativo di Login ERRATO [' + body.username + ' , ' + ']\n' + '[IP: ' + tools.getiPAddressUser(req) +
|
const msg = 'Tentativo di Login ERRATO [' + body.username + ' , ' + ']\n' + '[IP: ' + tools.getiPAddressUser(req) +
|
||||||
']';
|
']';
|
||||||
tools.mylogshow(msg);
|
tools.mylogshow(msg);
|
||||||
await telegrambot.sendMsgTelegramToTheAdmin(user.idapp, msg, true);
|
await telegrambot.sendMsgTelegramToTheAdmin(myuser.idapp, msg, true);
|
||||||
tools.writeErrorLog(msg);
|
tools.writeErrorLog(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 });
|
||||||
|
|||||||
@@ -797,63 +797,71 @@ const MyTelegramBot = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
notifyToTelegram: async function (phase, mylocalsconf) {
|
notifyToTelegram: async function (phase, mylocalsconf) {
|
||||||
let userdest = mylocalsconf.user.aportador_solidario;
|
try {
|
||||||
let langdest = mylocalsconf.user.lang;
|
let userdest = mylocalsconf.user.aportador_solidario;
|
||||||
let NameFrom = `${mylocalsconf.user.name} ${mylocalsconf.user.surname}`;
|
let langdest = mylocalsconf.user.lang;
|
||||||
if (!mylocalsconf.user.name) {
|
let NameFrom = `${mylocalsconf.user.name} ${mylocalsconf.user.surname}`;
|
||||||
NameFrom = `${mylocalsconf.user.username}`;
|
if (!mylocalsconf.user.name) {
|
||||||
}
|
NameFrom = `${mylocalsconf.user.username}`;
|
||||||
const index = mylocalsconf.user.index;
|
|
||||||
|
|
||||||
let aportador = '';
|
|
||||||
if (userdest) {
|
|
||||||
aportador = `${userdest}`;
|
|
||||||
NameFrom += aportador;
|
|
||||||
} else {
|
|
||||||
aportador = mylocalsconf.user.aportador_solidario_nome_completo
|
|
||||||
? mylocalsconf.user.aportador_solidario_nome_completo
|
|
||||||
: mylocalsconf.user.aportador_solidario;
|
|
||||||
}
|
|
||||||
|
|
||||||
let text = '';
|
|
||||||
if (phase === this.phase.REGISTRATION) {
|
|
||||||
|
|
||||||
if (tools.getConfSiteOptionEnabledByIdApp(mylocalsconf.idapp,
|
|
||||||
shared_consts.ConfSite.Notif_Reg_Bot_ToManagers)) {
|
|
||||||
if (userdest) {
|
|
||||||
NameFrom = await User.getNameSurnameByUsername(mylocalsconf.idapp,
|
|
||||||
userdest, true);
|
|
||||||
aportador = NameFrom ? NameFrom + ' ' + aportador : aportador;
|
|
||||||
}
|
|
||||||
const numutenti = await User.getNumUsers(mylocalsconf.idapp);
|
|
||||||
let nome = tools.getNomeCognomeEUserNameByUser(mylocalsconf.user);
|
|
||||||
text = printf(getstr(langdest, 'MSG_APORTADOR_USER_REGISTERED'), nome,
|
|
||||||
numutenti, aportador);
|
|
||||||
}
|
}
|
||||||
|
const index = mylocalsconf.user.index;
|
||||||
|
|
||||||
|
let aportador = '';
|
||||||
|
if (userdest) {
|
||||||
|
aportador = `${userdest}`;
|
||||||
|
NameFrom += aportador;
|
||||||
|
} else {
|
||||||
|
aportador = mylocalsconf.user.aportador_solidario_nome_completo
|
||||||
|
? mylocalsconf.user.aportador_solidario_nome_completo
|
||||||
|
: mylocalsconf.user.aportador_solidario;
|
||||||
|
}
|
||||||
|
|
||||||
|
let text = '';
|
||||||
|
if (phase === this.phase.REGISTRATION) {
|
||||||
|
|
||||||
|
if (tools.getConfSiteOptionEnabledByIdApp(mylocalsconf.idapp,
|
||||||
|
shared_consts.ConfSite.Notif_Reg_Bot_ToManagers)) {
|
||||||
|
if (userdest) {
|
||||||
|
NameFrom = await User.getNameSurnameByUsername(mylocalsconf.idapp,
|
||||||
|
userdest, true);
|
||||||
|
aportador = NameFrom ? NameFrom + ' ' + aportador : aportador;
|
||||||
|
}
|
||||||
|
const numutenti = await User.getNumUsers(mylocalsconf.idapp);
|
||||||
|
let nome = tools.getNomeCognomeEUserNameByUser(mylocalsconf.user);
|
||||||
|
text = printf(getstr(langdest, 'MSG_APORTADOR_USER_REGISTERED'), nome,
|
||||||
|
numutenti, aportador);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let addtext = '';
|
||||||
|
let rismsg = null;
|
||||||
|
|
||||||
|
if (text) {
|
||||||
|
|
||||||
|
await this.sendMsgTelegramToTheManagers(mylocalsconf.idapp,
|
||||||
|
addtext + text, false, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err notifyToTelegram', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
let addtext = '';
|
|
||||||
let rismsg = null;
|
|
||||||
|
|
||||||
if (text) {
|
|
||||||
|
|
||||||
await this.sendMsgTelegramToTheManagers(mylocalsconf.idapp,
|
|
||||||
addtext + text, false, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
notifyIscrizioneToTelegram: async function (phase, mylocalsconf, msg) {
|
notifyIscrizioneToTelegram: async function (phase, mylocalsconf, msg) {
|
||||||
let langdest = mylocalsconf.iscritto.lang;
|
try {
|
||||||
let NameFrom = `${mylocalsconf.iscritto.name} ${mylocalsconf.iscritto.surname}`;
|
let langdest = mylocalsconf.iscritto.lang;
|
||||||
|
let NameFrom = `${mylocalsconf.iscritto.name} ${mylocalsconf.iscritto.surname}`;
|
||||||
|
|
||||||
let nomeapp = tools.getHostByIdApp(mylocalsconf.idapp);
|
let nomeapp = tools.getHostByIdApp(mylocalsconf.idapp);
|
||||||
|
|
||||||
let text = printf(getstr(langdest, msg), NameFrom, nomeapp);
|
let text = printf(getstr(langdest, msg), NameFrom, nomeapp);
|
||||||
|
|
||||||
let addtext = '';
|
let addtext = '';
|
||||||
|
|
||||||
await this.sendMsgTelegramToTheManagers(mylocalsconf.idapp, addtext + text);
|
await this.sendMsgTelegramToTheManagers(mylocalsconf.idapp, addtext + text);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('notifyIscrizioneToTelegram', e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
askConfirmationUser: async function (idapp, myfunc, myuser, userDest = '', name = '', groupid = '', regexpire = '', groupname = '') {
|
askConfirmationUser: async function (idapp, myfunc, myuser, userDest = '', name = '', groupid = '', regexpire = '', groupname = '') {
|
||||||
|
|||||||
@@ -4386,6 +4386,8 @@ module.exports = {
|
|||||||
|
|
||||||
async isManagerByReq(req) {
|
async isManagerByReq(req) {
|
||||||
try {
|
try {
|
||||||
|
var { User } = require('../models/user');
|
||||||
|
|
||||||
const idapp = req.body.idapp;
|
const idapp = req.body.idapp;
|
||||||
let userId = '';
|
let userId = '';
|
||||||
if (req.body)
|
if (req.body)
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ const tools = require('./general');
|
|||||||
|
|
||||||
const shared_consts = require('./shared_nodejs');
|
const shared_consts = require('./shared_nodejs');
|
||||||
|
|
||||||
|
const server_constants = require('../tools/server_constants');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
@@ -496,6 +497,8 @@ module.exports = {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('INIZIO replaceUsername')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let ris = null;
|
let ris = null;
|
||||||
console.log('replaceUsername = ', search_username, replace_username);
|
console.log('replaceUsername = ', search_username, replace_username);
|
||||||
|
|||||||
Reference in New Issue
Block a user