- fix: authenticate_withUser mancava su alcuni...
- fix: '/signin' non riproponeva il login nel caso il token fosse invalido
This commit is contained in:
@@ -1813,11 +1813,11 @@ async function testMongoPerformance(ind, iterations = 20) {
|
||||
if (ind === 1) {
|
||||
await User.findOne({}).lean();
|
||||
} else {
|
||||
const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjIwODAwYWRjMTI5ZDFlYmE3NjBiZWNiIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoic3VyeWExOTc3IiwiaWF0IjoxNzQxODcyMzEwLCJleHAiOjE3NDE4Nzk1MTB9.SXJLmsS6EZVhaU7sUWYMnaqGpiiy8RfE9K43xTdxNuU';
|
||||
const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjIwODAwYWRjMTI5ZDFlYmE3NjBiZWNiIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoic3VyeWExOTc3IiwiaWF0IjoxNzQxODcyMzEwLCJleHAiOjE3NDE4Nzk1MTB9.SXJLmsS6EZVhaU7sUWYMnaqGpiiy8RfE9K43xTdxNuU';
|
||||
|
||||
await User.findByToken(token, 'auth', true, true);
|
||||
}
|
||||
|
||||
|
||||
} catch (err) {
|
||||
log(`Errore nell'iterazione ${i + 1}: ${err.message}`);
|
||||
}
|
||||
@@ -1917,9 +1917,14 @@ async function load(req, res, version = '0') {
|
||||
// Estrazione e validazione degli input
|
||||
const userId = req.user ? req.user._id.toString() : req.params.userId || '0';
|
||||
const idapp = req.params.idapp;
|
||||
const status = req.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED
|
||||
/*const status = req.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED
|
||||
? server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED
|
||||
: 200;
|
||||
: 200;*/
|
||||
|
||||
let status = req.code;
|
||||
if (status === server_constants.RIS_CODE_OK) {
|
||||
status = 200;
|
||||
}
|
||||
|
||||
// Determina se l'utente ha determinati permessi
|
||||
const gestoredelSito = req.user &&
|
||||
@@ -2118,7 +2123,8 @@ async function load(req, res, version = '0') {
|
||||
catalogs: data.catalogs,
|
||||
catprtotali: data.catprtotali
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// console.log(' ... 2) load dati caricati ...');
|
||||
res.status(status).send(responseData);
|
||||
|
||||
Reference in New Issue
Block a user