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,6 +797,7 @@ const MyTelegramBot = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
notifyToTelegram: async function (phase, mylocalsconf) {
|
notifyToTelegram: async function (phase, mylocalsconf) {
|
||||||
|
try {
|
||||||
let userdest = mylocalsconf.user.aportador_solidario;
|
let userdest = mylocalsconf.user.aportador_solidario;
|
||||||
let langdest = mylocalsconf.user.lang;
|
let langdest = mylocalsconf.user.lang;
|
||||||
let NameFrom = `${mylocalsconf.user.name} ${mylocalsconf.user.surname}`;
|
let NameFrom = `${mylocalsconf.user.name} ${mylocalsconf.user.surname}`;
|
||||||
@@ -841,9 +842,13 @@ const MyTelegramBot = {
|
|||||||
addtext + text, false, null);
|
addtext + text, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err notifyToTelegram', e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
notifyIscrizioneToTelegram: async function (phase, mylocalsconf, msg) {
|
notifyIscrizioneToTelegram: async function (phase, mylocalsconf, msg) {
|
||||||
|
try {
|
||||||
let langdest = mylocalsconf.iscritto.lang;
|
let langdest = mylocalsconf.iscritto.lang;
|
||||||
let NameFrom = `${mylocalsconf.iscritto.name} ${mylocalsconf.iscritto.surname}`;
|
let NameFrom = `${mylocalsconf.iscritto.name} ${mylocalsconf.iscritto.surname}`;
|
||||||
|
|
||||||
@@ -854,6 +859,9 @@ const MyTelegramBot = {
|
|||||||
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