- aggiornamento con proj RISO. postcss, pwa.

This commit is contained in:
Surya Paolo
2025-03-05 18:14:09 +01:00
parent f3597facd3
commit f6d8e1bb0b
5 changed files with 31 additions and 16 deletions

View File

@@ -30,7 +30,9 @@ const authenticate = (req, res, next) => {
const access = 'auth';
return User.findByToken(token, access, true).then((ris) => {
const idapp = getIdApp(req);
return User.findByToken(token, access, true, idapp).then((ris) => {
if (ris && ris.user && !!ris.user.deleted) {
if (ris.user.deleted)
@@ -70,14 +72,26 @@ const authenticate = (req, res, next) => {
});
};
const getIdApp = (req) => {
let idapp = null;
try {
idapp = req.query.idapp;
} catch (e) {
console.log('IDAPP NON TROVATO !');
}
return idapp;
}
const authenticate_noerror = (req, res, next) => {
try {
const token = req.header('x-auth');
const refreshToken = req.header('x-refrtok');
const access = 'auth';
const idapp = getIdApp(req);
return User.findByToken(token, access, false).then((ris) => {
const access = 'auth';
return User.findByToken(token, access, false, idapp).then((ris) => {
if (ris.code !== server_constants.RIS_CODE_OK) {
req.user = null;
req.token = null;