emilsoftware-utilities 1.3.27 → 1.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -193,7 +193,7 @@ var AccessiController = function () {
|
|
|
193
193
|
*/
|
|
194
194
|
AccessiController_1.prototype.login = function (req, res) {
|
|
195
195
|
return __awaiter(this, void 0, void 0, function () {
|
|
196
|
-
var request, userData, jwtOptions,
|
|
196
|
+
var request, userData, jwtOptions, error_1;
|
|
197
197
|
return __generator(this, function (_a) {
|
|
198
198
|
switch (_a.label) {
|
|
199
199
|
case 0:
|
|
@@ -205,8 +205,12 @@ var AccessiController = function () {
|
|
|
205
205
|
if (!userData)
|
|
206
206
|
return [2 /*return*/, Utilities_1.RestUtilities.sendErrorMessage(res, "Credenziali errate", AccessiController.name)];
|
|
207
207
|
jwtOptions = this.accessiModel.getOptions().jwtOptions;
|
|
208
|
-
token =
|
|
209
|
-
|
|
208
|
+
userData.token = {
|
|
209
|
+
expiresIn: jwtOptions.expiresIn,
|
|
210
|
+
value: jsonwebtoken_1.default.sign({ userData: userData }, jwtOptions.secret, { expiresIn: jwtOptions.expiresIn }),
|
|
211
|
+
type: "Bearer"
|
|
212
|
+
};
|
|
213
|
+
return [2 /*return*/, Utilities_1.RestUtilities.sendBaseResponse(res, userData)];
|
|
210
214
|
case 2:
|
|
211
215
|
error_1 = _a.sent();
|
|
212
216
|
return [2 /*return*/, Utilities_1.RestUtilities.sendErrorMessage(res, error_1, AccessiController.name)];
|
|
@@ -153,7 +153,7 @@ var AccessiModel = function () {
|
|
|
153
153
|
if (this.accessiOptions.mockDemoUser && request.username.toLowerCase() === "demo" && request.password.toLowerCase() === "demo")
|
|
154
154
|
return [2 /*return*/, this.getDemoUser()];
|
|
155
155
|
password = Utilities_1.CryptUtilities.encrypt(request.password, this.accessiOptions.encryptionKey);
|
|
156
|
-
userQuery = "\n SELECT\n U.CODUTE as codice_utente,\n U.USRNAME as username,\n U.FLGGDPR as flag_gdpr,\n U.DATGDPR as data_gdpr,\n U.DATINS as data_inserimento,\n U.DATSCAPWD as data_scadenza_password,\n U.DATLASTLOGIN as data_last_login,\n U.STAREG as stato_registrazione,\n U.KEYREG as key_registrazione,\n C.COGNOME as cognome,\n C.NOME as nome,\n C.AVATAR as avatar,\n C.FLG2FATT as flag_due_fattori,\n C.CAUMOV as cau_mov,\n C.CODLINGUA as codice_lingua,\n C.CELLULARE as cellulare,\n C.FLGSUPER as flag_super,\n C.FLGMOP as flag_mop,\n C.FLGPIANA as flag_piana,\n C.FLGADDETTI as flag_addetti,\n C.FLGOSPITI as flag_ospiti,\n C.FLGPIANARFID as flag_piana_rfid,\n C.FLGCONTA as flag_conta,\n C.FLGTINTEMI as flag_tintemi,\n C.FLGCUBI as flag_cubi,\n C.FLGCICLPASS as flag_cicl_pass,\n C.PAGDEF as pag_def,\n F.PROG as prog,\n F.NUMREP as num_rep,\n F.IDXPERS as idx_pers,\n F.CODCLISUPER as codice_cliente_super,\n F.CODAGE as codice_age
|
|
156
|
+
userQuery = "\n SELECT\n U.CODUTE as codice_utente,\n U.USRNAME as username,\n U.FLGGDPR as flag_gdpr,\n U.DATGDPR as data_gdpr,\n U.DATINS as data_inserimento,\n U.DATSCAPWD as data_scadenza_password,\n U.DATLASTLOGIN as data_last_login,\n U.STAREG as stato_registrazione,\n U.KEYREG as key_registrazione,\n C.COGNOME as cognome,\n C.NOME as nome,\n C.AVATAR as avatar,\n C.FLG2FATT as flag_due_fattori,\n C.CAUMOV as cau_mov,\n C.CODLINGUA as codice_lingua,\n C.CELLULARE as cellulare,\n C.FLGSUPER as flag_super,\n C.FLGMOP as flag_mop,\n C.FLGPIANA as flag_piana,\n C.FLGADDETTI as flag_addetti,\n C.FLGOSPITI as flag_ospiti,\n C.FLGPIANARFID as flag_piana_rfid,\n C.FLGCONTA as flag_conta,\n C.FLGTINTEMI as flag_tintemi,\n C.FLGCUBI as flag_cubi,\n C.FLGCICLPASS as flag_cicl_pass,\n C.PAGDEF as pag_def,\n F.PROG as prog,\n F.NUMREP as num_rep,\n F.IDXPERS as idx_pers,\n F.CODCLISUPER as codice_cliente_super,\n F.CODAGE as codice_age,\n F.CODCLICOL as codice_cliente_col, \n F.CODCLIENTI as codice_clienti,\n F.TIPFIL as tipo_fil\n\n FROM UTENTI U, UTENTI_CONFIG C, FILTRI F\n WHERE LOWER(U.USRNAME) = ?\n AND C.CODUTE=U.CODUTE AND F.CODUTE=U.CODUTE \n ";
|
|
157
157
|
userParams = [request.username];
|
|
158
158
|
return [4 /*yield*/, Orm_1.Orm.query(this.accessiOptions.databaseOptions, userQuery, userParams)];
|
|
159
159
|
case 1:
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { MenuAbilitazioniResult } from "../QueryResults/MenuAbilitazioniResult";
|
|
2
2
|
import { UserQueryResult } from "../QueryResults/UserQueryResult";
|
|
3
3
|
export interface LoginResponse {
|
|
4
|
+
token?: {
|
|
5
|
+
expiresIn: string;
|
|
6
|
+
value: string;
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
4
9
|
user: UserQueryResult;
|
|
5
10
|
abilitazioni: MenuAbilitazioniResult[];
|
|
6
11
|
}
|