fix order non si vedeva.. e msg login errato

This commit is contained in:
Surya Paolo
2024-01-17 21:49:59 +01:00
parent f6a0876178
commit dbcdbd689b
5 changed files with 68 additions and 52 deletions

View File

@@ -5013,9 +5013,10 @@ UserSchema.statics.getExtraInfoByUsername = async function (idapp, username) {
let myuser = await User.findOne({ idapp, username }).lean();
if (myuser) {
myuserextra = await User.addExtraInfo(idapp, myuser, null);
return myuser.profile;
}
return myuser.profile;
return null;
};
UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, version) {

View File

@@ -568,6 +568,8 @@ router.post('/login', (req, res) => {
let resalreadysent = false;
const myuser = user;
User.findByCredentials(user.idapp, user.username, user.password).
then(async (user) => {
// 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) +
']';
tools.mylogshow(msg);
await telegrambot.sendMsgTelegramToTheAdmin(user.idapp, msg, true);
await telegrambot.sendMsgTelegramToTheAdmin(myuser.idapp, msg, true);
tools.writeErrorLog(msg);
// telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR });

View File

@@ -797,6 +797,7 @@ const MyTelegramBot = {
},
notifyToTelegram: async function (phase, mylocalsconf) {
try {
let userdest = mylocalsconf.user.aportador_solidario;
let langdest = mylocalsconf.user.lang;
let NameFrom = `${mylocalsconf.user.name} ${mylocalsconf.user.surname}`;
@@ -841,9 +842,13 @@ const MyTelegramBot = {
addtext + text, false, null);
}
} catch (e) {
console.error('Err notifyToTelegram', e);
}
},
notifyIscrizioneToTelegram: async function (phase, mylocalsconf, msg) {
try {
let langdest = mylocalsconf.iscritto.lang;
let NameFrom = `${mylocalsconf.iscritto.name} ${mylocalsconf.iscritto.surname}`;
@@ -854,6 +859,9 @@ const MyTelegramBot = {
let addtext = '';
await this.sendMsgTelegramToTheManagers(mylocalsconf.idapp, addtext + text);
} catch (e) {
console.error('notifyIscrizioneToTelegram', e);
}
},
askConfirmationUser: async function (idapp, myfunc, myuser, userDest = '', name = '', groupid = '', regexpire = '', groupname = '') {

View File

@@ -4386,6 +4386,8 @@ module.exports = {
async isManagerByReq(req) {
try {
var { User } = require('../models/user');
const idapp = req.body.idapp;
let userId = '';
if (req.body)

View File

@@ -83,6 +83,7 @@ const tools = require('./general');
const shared_consts = require('./shared_nodejs');
const server_constants = require('../tools/server_constants');
module.exports = {
@@ -496,6 +497,8 @@ module.exports = {
return false;
}
console.log('INIZIO replaceUsername')
try {
let ris = null;
console.log('replaceUsername = ', search_username, replace_username);