emilsoftware-utilities 1.4.0-dev.1 → 1.4.0-dev.10
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.
- package/README.MD +34 -0
- package/dist/Utilities.d.ts +1 -0
- package/dist/Utilities.js +8 -0
- package/dist/accessi-module/AccessiModule.d.ts +11 -2
- package/dist/accessi-module/Controllers/AuthController.js +18 -0
- package/dist/accessi-module/Controllers/EmailController.d.ts +1 -0
- package/dist/accessi-module/Controllers/EmailController.js +33 -6
- package/dist/accessi-module/Controllers/UserController.d.ts +6 -6
- package/dist/accessi-module/Controllers/UserController.js +97 -49
- package/dist/accessi-module/Dtos/RegisterRequest.d.ts +2 -1
- package/dist/accessi-module/Dtos/RegisterRequest.js +78 -16
- package/dist/accessi-module/Services/AuthService/AuthService.js +17 -9
- package/dist/accessi-module/Services/EmailService/EmailService.d.ts +1 -1
- package/dist/accessi-module/Services/EmailService/EmailService.js +70 -32
- package/dist/accessi-module/Services/UserService/UserService.js +1 -0
- package/dist/emilsoftware-utilities-1.4.0-dev.10.tgz +0 -0
- package/package.json +1 -1
- package/dist/emilsoftware-utilities-1.4.0-dev.1.tgz +0 -0
package/README.MD
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Convenzioni per i Commit Message
|
|
2
|
+
|
|
3
|
+
1. feat:
|
|
4
|
+
Descrizione: Nuova feature
|
|
5
|
+
Esempio: feat: aggiunta endpoint per notifiche
|
|
6
|
+
Trigger: MINOR release (es. 1.3.0 -> 1.4.0)
|
|
7
|
+
Su dev: 1.4.0-dev.0
|
|
8
|
+
|
|
9
|
+
2. fix:
|
|
10
|
+
Descrizione: Correzione di bug
|
|
11
|
+
Esempio: fix: gestione errore null in login
|
|
12
|
+
Trigger: PATCH release (es. 1.3.1)
|
|
13
|
+
Su dev: 1.3.1-dev.0
|
|
14
|
+
|
|
15
|
+
3. BREAKING CHANGE:
|
|
16
|
+
Descrizione: Cambiamento che rompe la compatibilità all'indietro
|
|
17
|
+
Esempio:
|
|
18
|
+
feat!: rimozione supporto legacy
|
|
19
|
+
BREAKING CHANGE: cambia lo schema JWT
|
|
20
|
+
Trigger: MAJOR release (es. 1.0.0 -> 2.0.0)
|
|
21
|
+
|
|
22
|
+
4. Altri tipi di commit
|
|
23
|
+
Esempi: chore:, docs:, test:, refactor:
|
|
24
|
+
Descrizione: Non triggerano una release di default, a meno che non siano configurati esplicitamente nel commit-analyzer.
|
|
25
|
+
Esempio: chore: aggiorna dipendenze
|
|
26
|
+
|
|
27
|
+
5. Forzare una Release
|
|
28
|
+
Descrizione: Utile in caso di merge o altre operazioni.
|
|
29
|
+
Comandi:
|
|
30
|
+
git commit --allow-empty -m "feat: trigger test release"
|
|
31
|
+
Poi:
|
|
32
|
+
git push origin dev
|
|
33
|
+
Oppure:
|
|
34
|
+
git push origin main
|
package/dist/Utilities.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare class RestUtilities {
|
|
|
64
64
|
static sendErrorMessage(res: Response, error: any, tag?: string, status?: number): Response;
|
|
65
65
|
static sendUnauthorized(res: Response): Response;
|
|
66
66
|
static sendInvalidCredentials(res: Response): Response;
|
|
67
|
+
static sendPasswordExpired(res: Response): Response;
|
|
67
68
|
/**
|
|
68
69
|
* Sends a base response with a payload.
|
|
69
70
|
* @param res - Express Response object.
|
package/dist/Utilities.js
CHANGED
|
@@ -138,6 +138,14 @@ class RestUtilities {
|
|
|
138
138
|
message: "Credenziali non valide"
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
+
static sendPasswordExpired(res) {
|
|
142
|
+
return res.status(403).send({
|
|
143
|
+
severity: "warning",
|
|
144
|
+
statusCode: StatusCode.Warning,
|
|
145
|
+
code: "PASSWORD_EXPIRED",
|
|
146
|
+
message: "Password scaduta. E' necessario aggiornarla"
|
|
147
|
+
});
|
|
148
|
+
}
|
|
141
149
|
/**
|
|
142
150
|
* Sends a base response with a payload.
|
|
143
151
|
* @param res - Express Response object.
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @module AccessiModule
|
|
5
5
|
* @author mttdev382
|
|
6
6
|
*/
|
|
7
|
-
import { Options } from
|
|
8
|
-
import { DynamicModule } from
|
|
7
|
+
import { Options } from 'es-node-firebird';
|
|
8
|
+
import { DynamicModule } from '@nestjs/common';
|
|
9
9
|
export interface JwtOptions {
|
|
10
10
|
secret: string;
|
|
11
11
|
expiresIn: string;
|
|
@@ -29,11 +29,20 @@ export interface ExtensionFieldsOptions {
|
|
|
29
29
|
}
|
|
30
30
|
export interface AccessiOptions {
|
|
31
31
|
databaseOptions: Options;
|
|
32
|
+
/**
|
|
33
|
+
* Basepath del sito es: 'http://www.il-mio-sito.it/nome-progetto(se c'è)'
|
|
34
|
+
*/
|
|
32
35
|
confirmationEmailUrl: string;
|
|
36
|
+
/**
|
|
37
|
+
* Percorso della pagina di reset personalizzata es. http://localhost:4200/#/admin/reset-password
|
|
38
|
+
* N.B si sostituisce al confirmationMailURl
|
|
39
|
+
*/
|
|
40
|
+
customResetPage?: string;
|
|
33
41
|
confirmationEmailReturnUrl: string;
|
|
34
42
|
confirmationEmailPrefix?: string;
|
|
35
43
|
encryptionKey: string;
|
|
36
44
|
mockDemoUser: boolean;
|
|
45
|
+
passwordExpiration?: boolean;
|
|
37
46
|
jwtOptions: JwtOptions;
|
|
38
47
|
emailOptions: EmailOptions;
|
|
39
48
|
extensionFieldsOptions?: ExtensionFieldsOptions[];
|
|
@@ -112,6 +112,10 @@ let AuthController = AuthController_1 = class AuthController {
|
|
|
112
112
|
return Utilities_1.RestUtilities.sendBaseResponse(res, userData);
|
|
113
113
|
}
|
|
114
114
|
catch (error) {
|
|
115
|
+
if (error.message === 'PASSWORD_EXPIRED') {
|
|
116
|
+
this.logger.warning('Password scaduta, cambiare password ', error);
|
|
117
|
+
return Utilities_1.RestUtilities.sendPasswordExpired(res);
|
|
118
|
+
}
|
|
115
119
|
this.logger.error('Errore durante il login', error);
|
|
116
120
|
return Utilities_1.RestUtilities.sendInvalidCredentials(res);
|
|
117
121
|
}
|
|
@@ -161,6 +165,20 @@ __decorate([
|
|
|
161
165
|
status: 401,
|
|
162
166
|
description: 'Credenziali non valide',
|
|
163
167
|
}),
|
|
168
|
+
(0, swagger_1.ApiResponse)({
|
|
169
|
+
status: 403,
|
|
170
|
+
description: "Password scaduta, è necessatio aggiornarla. ",
|
|
171
|
+
schema: {
|
|
172
|
+
example: {
|
|
173
|
+
message: {
|
|
174
|
+
severity: 'warning',
|
|
175
|
+
statusCode: 2, // o il valore di StatusCode.Warning
|
|
176
|
+
code: 'PASSWORD_EXPIRED',
|
|
177
|
+
message: 'Password scaduta. È necessario aggiornarla.',
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}),
|
|
164
182
|
(0, common_1.Post)('login'),
|
|
165
183
|
__param(0, (0, common_1.Body)()),
|
|
166
184
|
__param(1, (0, common_1.Res)()),
|
|
@@ -8,5 +8,6 @@ export declare class EmailController {
|
|
|
8
8
|
serveResetPasswordPage(res: Response, token: string, returnUrl?: string): Promise<void>;
|
|
9
9
|
sendPasswordResetEmail(request: Request, sendResetPasswordData: {
|
|
10
10
|
email: string;
|
|
11
|
+
htmlMail?: string;
|
|
11
12
|
}, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
12
13
|
}
|
|
@@ -41,7 +41,7 @@ let EmailController = EmailController_1 = class EmailController {
|
|
|
41
41
|
sendPasswordResetEmail(request, sendResetPasswordData, res) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
try {
|
|
44
|
-
yield this.emailService.sendPasswordResetEmail(sendResetPasswordData.email);
|
|
44
|
+
yield this.emailService.sendPasswordResetEmail(sendResetPasswordData.email, sendResetPasswordData.htmlMail);
|
|
45
45
|
return Utilities_1.RestUtilities.sendOKMessage(res, "L'email di reset è stata inoltrata al destinatario.");
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
@@ -52,9 +52,16 @@ let EmailController = EmailController_1 = class EmailController {
|
|
|
52
52
|
};
|
|
53
53
|
exports.EmailController = EmailController;
|
|
54
54
|
__decorate([
|
|
55
|
-
(0, swagger_1.ApiOperation)({
|
|
55
|
+
(0, swagger_1.ApiOperation)({
|
|
56
|
+
summary: 'Serve una pagina per il reset della password',
|
|
57
|
+
operationId: 'serveResetPasswordPage',
|
|
58
|
+
}),
|
|
56
59
|
(0, swagger_1.ApiParam)({ name: 'token', description: 'Token per il reset della password', required: true }),
|
|
57
|
-
(0, swagger_1.ApiQuery)({
|
|
60
|
+
(0, swagger_1.ApiQuery)({
|
|
61
|
+
name: 'returnUrl',
|
|
62
|
+
description: 'Url di ritorno della pagina. Default: https://google.com',
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
58
65
|
(0, swagger_1.ApiResponse)({ status: 200, description: 'Pagina di reset password servita con successo' }),
|
|
59
66
|
(0, common_1.Get)('reset-password-page/:token'),
|
|
60
67
|
__param(0, (0, common_1.Res)()),
|
|
@@ -65,10 +72,30 @@ __decorate([
|
|
|
65
72
|
__metadata("design:returntype", Promise)
|
|
66
73
|
], EmailController.prototype, "serveResetPasswordPage", null);
|
|
67
74
|
__decorate([
|
|
68
|
-
(0, swagger_1.ApiOperation)({
|
|
69
|
-
|
|
75
|
+
(0, swagger_1.ApiOperation)({
|
|
76
|
+
summary: 'Invia una e-mail per il reset della password',
|
|
77
|
+
operationId: 'sendPasswordResetEmail',
|
|
78
|
+
}),
|
|
79
|
+
(0, swagger_1.ApiBody)({
|
|
80
|
+
schema: {
|
|
81
|
+
properties: {
|
|
82
|
+
email: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: "L'email dell'utente che richiede il reset",
|
|
85
|
+
},
|
|
86
|
+
htmlMail: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'Corpo della mail in HTML',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ['email'],
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
70
94
|
(0, swagger_1.ApiResponse)({ status: 200, description: "L'email di reset è stata inviata con successo" }),
|
|
71
|
-
(0, swagger_1.ApiResponse)({
|
|
95
|
+
(0, swagger_1.ApiResponse)({
|
|
96
|
+
status: 400,
|
|
97
|
+
description: 'Errore nella richiesta: protocollo o host non impostati',
|
|
98
|
+
}),
|
|
72
99
|
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno durante l'invio dell'email" }),
|
|
73
100
|
(0, common_1.Post)('send-reset-password-email'),
|
|
74
101
|
__param(0, (0, common_1.Req)()),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Response, Request } from
|
|
2
|
-
import { AccessiOptions } from
|
|
3
|
-
import { UserService } from
|
|
4
|
-
import { EmailService } from
|
|
5
|
-
import { UserDto } from
|
|
6
|
-
import { RegisterRequest } from
|
|
1
|
+
import { Response, Request } from "express";
|
|
2
|
+
import { AccessiOptions } from "../AccessiModule";
|
|
3
|
+
import { UserService } from "../Services/UserService/UserService";
|
|
4
|
+
import { EmailService } from "../Services/EmailService/EmailService";
|
|
5
|
+
import { UserDto } from "../Dtos";
|
|
6
|
+
import { RegisterRequest } from "../Dtos/RegisterRequest";
|
|
7
7
|
export declare class UserController {
|
|
8
8
|
private readonly userService;
|
|
9
9
|
private readonly emailService;
|
|
@@ -43,19 +43,22 @@ let UserController = UserController_1 = class UserController {
|
|
|
43
43
|
}
|
|
44
44
|
serveResetPasswordPage(res, token) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
return res.sendFile((0, path_1.join)(__dirname,
|
|
46
|
+
return res.sendFile((0, path_1.join)(__dirname, "..", "Views", "reset-password.html"));
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
getUsers(res, email, codiceUtente, includeExtensionFields, includeGrants) {
|
|
50
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
51
|
try {
|
|
52
52
|
let filters = { email, codiceUtente };
|
|
53
|
-
let options = {
|
|
53
|
+
let options = {
|
|
54
|
+
includeExtensionFields: includeExtensionFields !== null && includeExtensionFields !== void 0 ? includeExtensionFields : true,
|
|
55
|
+
includeGrants: includeGrants !== null && includeGrants !== void 0 ? includeGrants : true,
|
|
56
|
+
};
|
|
54
57
|
const users = yield this.userService.getUsers(filters, options);
|
|
55
58
|
return Utilities_1.RestUtilities.sendBaseResponse(res, users);
|
|
56
59
|
}
|
|
57
60
|
catch (error) {
|
|
58
|
-
this.logger.error(
|
|
61
|
+
this.logger.error("Errore durante il recupero degli utenti: ", error);
|
|
59
62
|
return Utilities_1.RestUtilities.sendErrorMessage(res, error, UserController_1.name);
|
|
60
63
|
}
|
|
61
64
|
});
|
|
@@ -77,7 +80,7 @@ let UserController = UserController_1 = class UserController {
|
|
|
77
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
81
|
try {
|
|
79
82
|
const codiceUtente = yield this.userService.register(registrationData);
|
|
80
|
-
yield this.emailService.sendPasswordResetEmail(registrationData.email);
|
|
83
|
+
yield this.emailService.sendPasswordResetEmail(registrationData.email, registrationData.htmlMail);
|
|
81
84
|
return Utilities_1.RestUtilities.sendBaseResponse(res, codiceUtente);
|
|
82
85
|
}
|
|
83
86
|
catch (error) {
|
|
@@ -114,46 +117,79 @@ let UserController = UserController_1 = class UserController {
|
|
|
114
117
|
};
|
|
115
118
|
exports.UserController = UserController;
|
|
116
119
|
__decorate([
|
|
117
|
-
(0, swagger_1.ApiOperation)({
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
(0, swagger_1.ApiOperation)({
|
|
121
|
+
summary: "Servire la pagina di reset password",
|
|
122
|
+
operationId: "serveResetPasswordPageUser",
|
|
123
|
+
}),
|
|
124
|
+
(0, swagger_1.ApiParam)({
|
|
125
|
+
name: "token",
|
|
126
|
+
description: "Token per il reset della password",
|
|
127
|
+
required: true,
|
|
128
|
+
}),
|
|
129
|
+
(0, common_1.Get)("reset-password/:token"),
|
|
120
130
|
__param(0, (0, common_1.Res)()),
|
|
121
|
-
__param(1, (0, common_1.Param)(
|
|
131
|
+
__param(1, (0, common_1.Param)("token")),
|
|
122
132
|
__metadata("design:type", Function),
|
|
123
133
|
__metadata("design:paramtypes", [Object, String]),
|
|
124
134
|
__metadata("design:returntype", Promise)
|
|
125
135
|
], UserController.prototype, "serveResetPasswordPage", null);
|
|
126
136
|
__decorate([
|
|
127
|
-
(0, swagger_1.ApiOperation)({
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
(0, swagger_1.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
(0, swagger_1.ApiOperation)({
|
|
138
|
+
summary: "Recupera la lista degli utenti",
|
|
139
|
+
operationId: "getUsers",
|
|
140
|
+
}),
|
|
141
|
+
(0, swagger_1.ApiResponse)({
|
|
142
|
+
status: 200,
|
|
143
|
+
description: "Lista utenti recuperata con successo",
|
|
144
|
+
type: GetUsersResponse_1.GetUsersResponse,
|
|
145
|
+
}),
|
|
146
|
+
(0, swagger_1.ApiResponse)({ status: 401, description: "Credenziali non valide" }),
|
|
147
|
+
(0, swagger_1.ApiQuery)({
|
|
148
|
+
name: "email",
|
|
149
|
+
required: false,
|
|
150
|
+
description: "Email dell'utente da cercare",
|
|
151
|
+
}),
|
|
152
|
+
(0, swagger_1.ApiQuery)({
|
|
153
|
+
name: "codiceUtente",
|
|
154
|
+
required: false,
|
|
155
|
+
description: "Codice dell'utente da cercare",
|
|
156
|
+
}),
|
|
157
|
+
(0, swagger_1.ApiQuery)({
|
|
158
|
+
name: "includeExtensionFields",
|
|
159
|
+
required: false,
|
|
160
|
+
description: "Includi extension fields (chiamata più pesante)",
|
|
161
|
+
}),
|
|
162
|
+
(0, swagger_1.ApiQuery)({
|
|
163
|
+
name: "includeGrants",
|
|
164
|
+
required: false,
|
|
165
|
+
description: "Includi Permessi (chiamata più pesante)",
|
|
166
|
+
}),
|
|
167
|
+
(0, common_1.Get)("get-users"),
|
|
135
168
|
__param(0, (0, common_1.Res)()),
|
|
136
|
-
__param(1, (0, common_1.Query)(
|
|
137
|
-
__param(2, (0, common_1.Query)(
|
|
138
|
-
__param(3, (0, common_1.Query)(
|
|
139
|
-
__param(4, (0, common_1.Query)(
|
|
169
|
+
__param(1, (0, common_1.Query)("email")),
|
|
170
|
+
__param(2, (0, common_1.Query)("codiceUtente")),
|
|
171
|
+
__param(3, (0, common_1.Query)("includeExtensionFields", new common_1.ParseBoolPipe({ optional: true }))),
|
|
172
|
+
__param(4, (0, common_1.Query)("includeGrants", new common_1.ParseBoolPipe({ optional: true }))),
|
|
140
173
|
__metadata("design:type", Function),
|
|
141
174
|
__metadata("design:paramtypes", [Object, String, Number, Boolean, Boolean]),
|
|
142
175
|
__metadata("design:returntype", Promise)
|
|
143
176
|
], UserController.prototype, "getUsers", null);
|
|
144
177
|
__decorate([
|
|
145
|
-
(0, swagger_1.ApiOperation)({ summary:
|
|
178
|
+
(0, swagger_1.ApiOperation)({ summary: "Elimina un utente", operationId: "deleteUser" }),
|
|
146
179
|
(0, swagger_1.ApiParam)({
|
|
147
|
-
name:
|
|
180
|
+
name: "codiceUtente",
|
|
148
181
|
description: "Codice identificativo dell'utente da eliminare",
|
|
149
182
|
required: true,
|
|
150
|
-
example: "USR123"
|
|
183
|
+
example: "USR123",
|
|
151
184
|
}),
|
|
152
185
|
(0, swagger_1.ApiResponse)({ status: 200, description: "Utente eliminato con successo" }),
|
|
153
|
-
(0, swagger_1.ApiResponse)({
|
|
186
|
+
(0, swagger_1.ApiResponse)({
|
|
187
|
+
status: 400,
|
|
188
|
+
description: "Errore nei parametri della richiesta",
|
|
189
|
+
}),
|
|
154
190
|
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno del server" }),
|
|
155
|
-
(0, common_1.Delete)(
|
|
156
|
-
__param(0, (0, common_1.Param)(
|
|
191
|
+
(0, common_1.Delete)("delete-user/:codiceUtente"),
|
|
192
|
+
__param(0, (0, common_1.Param)("codiceUtente")),
|
|
157
193
|
__param(1, (0, common_1.Res)()),
|
|
158
194
|
__metadata("design:type", Function),
|
|
159
195
|
__metadata("design:paramtypes", [Number, Object]),
|
|
@@ -161,26 +197,26 @@ __decorate([
|
|
|
161
197
|
], UserController.prototype, "deleteUser", null);
|
|
162
198
|
__decorate([
|
|
163
199
|
(0, swagger_1.ApiOperation)({
|
|
164
|
-
summary:
|
|
165
|
-
operationId:
|
|
200
|
+
summary: "Registra un nuovo utente",
|
|
201
|
+
operationId: "register",
|
|
166
202
|
}),
|
|
167
203
|
(0, swagger_1.ApiBody)({
|
|
168
204
|
type: RegisterRequest_1.RegisterRequest,
|
|
169
|
-
description: "Dati necessari per la registrazione dell'utente"
|
|
205
|
+
description: "Dati necessari per la registrazione dell'utente",
|
|
170
206
|
}),
|
|
171
207
|
(0, swagger_1.ApiCreatedResponse)({
|
|
172
|
-
description:
|
|
173
|
-
type: RegisterResponse_1.RegisterResponse
|
|
208
|
+
description: "Utente registrato con successo. Restituisce il codice utente e invia una mail di conferma/reset password.",
|
|
209
|
+
type: RegisterResponse_1.RegisterResponse,
|
|
174
210
|
}),
|
|
175
211
|
(0, swagger_1.ApiResponse)({
|
|
176
212
|
status: common_1.HttpStatus.BAD_REQUEST,
|
|
177
|
-
description:
|
|
213
|
+
description: "Errore nella registrazione. Potrebbe essere dovuto a dati mancanti, email già esistente o configurazione non valida.",
|
|
178
214
|
}),
|
|
179
215
|
(0, swagger_1.ApiResponse)({
|
|
180
216
|
status: common_1.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
181
|
-
description:
|
|
217
|
+
description: "Errore interno del server durante la registrazione o l’invio dell’email.",
|
|
182
218
|
}),
|
|
183
|
-
(0, common_1.Post)(
|
|
219
|
+
(0, common_1.Post)("register"),
|
|
184
220
|
__param(0, (0, common_1.Req)()),
|
|
185
221
|
__param(1, (0, common_1.Body)()),
|
|
186
222
|
__param(2, (0, common_1.Res)()),
|
|
@@ -189,21 +225,27 @@ __decorate([
|
|
|
189
225
|
__metadata("design:returntype", Promise)
|
|
190
226
|
], UserController.prototype, "register", null);
|
|
191
227
|
__decorate([
|
|
192
|
-
(0, swagger_1.ApiOperation)({
|
|
228
|
+
(0, swagger_1.ApiOperation)({
|
|
229
|
+
summary: "Aggiorna un utente esistente",
|
|
230
|
+
operationId: "updateUtente",
|
|
231
|
+
}),
|
|
193
232
|
(0, swagger_1.ApiParam)({
|
|
194
|
-
name:
|
|
233
|
+
name: "codiceUtente",
|
|
195
234
|
description: "Codice identificativo dell'utente da aggiornare",
|
|
196
235
|
required: true,
|
|
197
|
-
example: "USR123"
|
|
236
|
+
example: "USR123",
|
|
198
237
|
}),
|
|
199
238
|
(0, swagger_1.ApiBody)({
|
|
200
239
|
type: Dtos_1.UserDto,
|
|
201
|
-
description: "Dati aggiornati dell'utente (escluso il codice utente, che è nel path)"
|
|
240
|
+
description: "Dati aggiornati dell'utente (escluso il codice utente, che è nel path)",
|
|
241
|
+
}),
|
|
242
|
+
(0, swagger_1.ApiResponse)({
|
|
243
|
+
status: common_1.HttpStatus.OK,
|
|
244
|
+
description: "Utente aggiornato con successo",
|
|
202
245
|
}),
|
|
203
|
-
(0, swagger_1.ApiResponse)({ status: common_1.HttpStatus.OK, description: "Utente aggiornato con successo" }),
|
|
204
246
|
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nell'aggiornamento" }),
|
|
205
|
-
(0, common_1.Put)(
|
|
206
|
-
__param(0, (0, common_1.Param)(
|
|
247
|
+
(0, common_1.Put)("update-user/:codiceUtente"),
|
|
248
|
+
__param(0, (0, common_1.Param)("codiceUtente")),
|
|
207
249
|
__param(1, (0, common_1.Body)()),
|
|
208
250
|
__param(2, (0, common_1.Res)()),
|
|
209
251
|
__metadata("design:type", Function),
|
|
@@ -211,26 +253,32 @@ __decorate([
|
|
|
211
253
|
__metadata("design:returntype", Promise)
|
|
212
254
|
], UserController.prototype, "updateUtente", null);
|
|
213
255
|
__decorate([
|
|
214
|
-
(0, swagger_1.ApiOperation)({
|
|
256
|
+
(0, swagger_1.ApiOperation)({
|
|
257
|
+
summary: "Imposta il consenso GDPR per un utente",
|
|
258
|
+
operationId: "setGdpr",
|
|
259
|
+
}),
|
|
215
260
|
(0, swagger_1.ApiParam)({
|
|
216
261
|
name: "codiceUtente",
|
|
217
262
|
description: "Codice identificativo dell'utente che accetta il GDPR",
|
|
218
263
|
required: true,
|
|
219
|
-
example: "USR123"
|
|
264
|
+
example: "USR123",
|
|
265
|
+
}),
|
|
266
|
+
(0, swagger_1.ApiResponse)({
|
|
267
|
+
status: 200,
|
|
268
|
+
description: "Consenso GDPR impostato con successo",
|
|
220
269
|
}),
|
|
221
|
-
(0, swagger_1.ApiResponse)({ status: 200, description: "Consenso GDPR impostato con successo" }),
|
|
222
270
|
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nella richiesta" }),
|
|
223
|
-
(0, common_1.Patch)(
|
|
224
|
-
__param(0, (0, common_1.Param)(
|
|
271
|
+
(0, common_1.Patch)("set-gdpr/:codiceUtente"),
|
|
272
|
+
__param(0, (0, common_1.Param)("codiceUtente")),
|
|
225
273
|
__param(1, (0, common_1.Res)()),
|
|
226
274
|
__metadata("design:type", Function),
|
|
227
275
|
__metadata("design:paramtypes", [Number, Object]),
|
|
228
276
|
__metadata("design:returntype", Promise)
|
|
229
277
|
], UserController.prototype, "setGdpr", null);
|
|
230
278
|
exports.UserController = UserController = UserController_1 = __decorate([
|
|
231
|
-
(0, swagger_1.ApiTags)(
|
|
232
|
-
(0, common_1.Controller)(
|
|
233
|
-
__param(2, (0, common_1.Inject)(
|
|
279
|
+
(0, swagger_1.ApiTags)("User"),
|
|
280
|
+
(0, common_1.Controller)("accessi/user"),
|
|
281
|
+
__param(2, (0, common_1.Inject)("ACCESSI_OPTIONS")),
|
|
234
282
|
__metadata("design:paramtypes", [UserService_1.UserService,
|
|
235
283
|
EmailService_1.EmailService, Object])
|
|
236
284
|
], UserController);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Permission } from
|
|
1
|
+
import { Permission } from "./Permission";
|
|
2
2
|
export declare class RegisterRequest {
|
|
3
3
|
email: string;
|
|
4
4
|
cognome?: string;
|
|
@@ -18,4 +18,5 @@ export declare class RegisterRequest {
|
|
|
18
18
|
flagDueFattori?: boolean;
|
|
19
19
|
paginaDefault?: string;
|
|
20
20
|
ragSocCli?: string;
|
|
21
|
+
htmlMail?: string;
|
|
21
22
|
}
|
|
@@ -17,11 +17,17 @@ class RegisterRequest {
|
|
|
17
17
|
}
|
|
18
18
|
exports.RegisterRequest = RegisterRequest;
|
|
19
19
|
__decorate([
|
|
20
|
-
(0, swagger_1.ApiProperty)({
|
|
20
|
+
(0, swagger_1.ApiProperty)({
|
|
21
|
+
description: "Email dell'utente.",
|
|
22
|
+
example: "mario.rossi@dev.it",
|
|
23
|
+
}),
|
|
21
24
|
__metadata("design:type", String)
|
|
22
25
|
], RegisterRequest.prototype, "email", void 0);
|
|
23
26
|
__decorate([
|
|
24
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
27
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
28
|
+
description: "Cognome dell'utente.",
|
|
29
|
+
example: "Rossi",
|
|
30
|
+
}),
|
|
25
31
|
__metadata("design:type", String)
|
|
26
32
|
], RegisterRequest.prototype, "cognome", void 0);
|
|
27
33
|
__decorate([
|
|
@@ -29,7 +35,11 @@ __decorate([
|
|
|
29
35
|
__metadata("design:type", String)
|
|
30
36
|
], RegisterRequest.prototype, "nome", void 0);
|
|
31
37
|
__decorate([
|
|
32
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
38
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
39
|
+
description: "Numero di cellulare.",
|
|
40
|
+
example: "+393401234567",
|
|
41
|
+
nullable: true,
|
|
42
|
+
}),
|
|
33
43
|
__metadata("design:type", String)
|
|
34
44
|
], RegisterRequest.prototype, "cellulare", void 0);
|
|
35
45
|
__decorate([
|
|
@@ -37,54 +47,106 @@ __decorate([
|
|
|
37
47
|
__metadata("design:type", Boolean)
|
|
38
48
|
], RegisterRequest.prototype, "flagSuper", void 0);
|
|
39
49
|
__decorate([
|
|
40
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
50
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
51
|
+
description: "Ruoli assegnati all'utente.",
|
|
52
|
+
example: ["admin", "editor"],
|
|
53
|
+
}),
|
|
41
54
|
__metadata("design:type", Array)
|
|
42
55
|
], RegisterRequest.prototype, "roles", void 0);
|
|
43
56
|
__decorate([
|
|
44
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
57
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
58
|
+
description: "Permessi assegnati all'utente.",
|
|
59
|
+
type: [Permission_1.Permission],
|
|
60
|
+
example: [
|
|
61
|
+
{
|
|
62
|
+
codiceMenu: "MNUOFFICINA",
|
|
63
|
+
tipoAbilitazione: TipoAbilitazione_1.TipoAbilitazione.SCRITTURA,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
}),
|
|
45
67
|
__metadata("design:type", Array)
|
|
46
68
|
], RegisterRequest.prototype, "permissions", void 0);
|
|
47
69
|
__decorate([
|
|
48
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
70
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
71
|
+
description: "Numero del report associato.",
|
|
72
|
+
example: 1002,
|
|
73
|
+
}),
|
|
49
74
|
__metadata("design:type", Number)
|
|
50
75
|
], RegisterRequest.prototype, "numeroReport", void 0);
|
|
51
76
|
__decorate([
|
|
52
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
77
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
78
|
+
description: "Indice personale dell'utente.",
|
|
79
|
+
example: 15,
|
|
80
|
+
}),
|
|
53
81
|
__metadata("design:type", Number)
|
|
54
82
|
], RegisterRequest.prototype, "indicePersonale", void 0);
|
|
55
83
|
__decorate([
|
|
56
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
84
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
85
|
+
description: "Codice del cliente principale (super).",
|
|
86
|
+
example: "CLT_SUP_1234",
|
|
87
|
+
}),
|
|
57
88
|
__metadata("design:type", String)
|
|
58
89
|
], RegisterRequest.prototype, "codiceClienteSuper", void 0);
|
|
59
90
|
__decorate([
|
|
60
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
91
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
92
|
+
description: "Codice dell'agenzia associata.",
|
|
93
|
+
example: "AGZ_5678",
|
|
94
|
+
}),
|
|
61
95
|
__metadata("design:type", String)
|
|
62
96
|
], RegisterRequest.prototype, "codiceAgenzia", void 0);
|
|
63
97
|
__decorate([
|
|
64
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
98
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
99
|
+
description: "Codice del cliente collegato.",
|
|
100
|
+
example: "CLT_COL_8765",
|
|
101
|
+
}),
|
|
65
102
|
__metadata("design:type", String)
|
|
66
103
|
], RegisterRequest.prototype, "codiceClienteCollegato", void 0);
|
|
67
104
|
__decorate([
|
|
68
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
105
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
106
|
+
description: "Lista di codici clienti separati da virgola.",
|
|
107
|
+
example: "CLT_123,CLT_456,CLT_789",
|
|
108
|
+
}),
|
|
69
109
|
__metadata("design:type", String)
|
|
70
110
|
], RegisterRequest.prototype, "codiceClienti", void 0);
|
|
71
111
|
__decorate([
|
|
72
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
112
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
113
|
+
description: "Tipo di filtro applicato.",
|
|
114
|
+
example: "esclusivo",
|
|
115
|
+
}),
|
|
73
116
|
__metadata("design:type", String)
|
|
74
117
|
], RegisterRequest.prototype, "tipoFiltro", void 0);
|
|
75
118
|
__decorate([
|
|
76
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
119
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
120
|
+
description: "Avatar dell'utente.",
|
|
121
|
+
example: "user.svg",
|
|
122
|
+
}),
|
|
77
123
|
__metadata("design:type", String)
|
|
78
124
|
], RegisterRequest.prototype, "avatar", void 0);
|
|
79
125
|
__decorate([
|
|
80
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
126
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
127
|
+
description: "Flag autenticazione a due fattori.",
|
|
128
|
+
example: false,
|
|
129
|
+
}),
|
|
81
130
|
__metadata("design:type", Boolean)
|
|
82
131
|
], RegisterRequest.prototype, "flagDueFattori", void 0);
|
|
83
132
|
__decorate([
|
|
84
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
133
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
134
|
+
description: "Pagina di default dell'utente.",
|
|
135
|
+
example: "/dashboard",
|
|
136
|
+
}),
|
|
85
137
|
__metadata("design:type", String)
|
|
86
138
|
], RegisterRequest.prototype, "paginaDefault", void 0);
|
|
87
139
|
__decorate([
|
|
88
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
140
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
141
|
+
description: "Ragione sociale cliente.",
|
|
142
|
+
example: "ALIVAL STOCK",
|
|
143
|
+
}),
|
|
89
144
|
__metadata("design:type", String)
|
|
90
145
|
], RegisterRequest.prototype, "ragSocCli", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
148
|
+
description: "HTML mail personalizzato",
|
|
149
|
+
example: "<html></html>",
|
|
150
|
+
}),
|
|
151
|
+
__metadata("design:type", String)
|
|
152
|
+
], RegisterRequest.prototype, "htmlMail", void 0);
|
|
@@ -36,9 +36,11 @@ let AuthService = class AuthService {
|
|
|
36
36
|
}
|
|
37
37
|
login(request) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
if (this.accessiOptions.mockDemoUser &&
|
|
39
|
+
if (this.accessiOptions.mockDemoUser &&
|
|
40
|
+
request.email.toLowerCase() === "demo")
|
|
40
41
|
return this.getDemoUser();
|
|
41
|
-
if (this.accessiOptions.mockDemoUser &&
|
|
42
|
+
if (this.accessiOptions.mockDemoUser &&
|
|
43
|
+
request.email.toLowerCase() === "admin")
|
|
42
44
|
return this.getAdminUser();
|
|
43
45
|
const passwordCifrata = Utilities_1.CryptUtilities.encrypt(request.password, this.accessiOptions.encryptionKey);
|
|
44
46
|
const utente = yield this.userService.getUserByEmail(request.email.toLowerCase());
|
|
@@ -61,10 +63,13 @@ let AuthService = class AuthService {
|
|
|
61
63
|
const isPasswordValid = yield this.verifyPassword(utente.codiceUtente, passwordCifrata);
|
|
62
64
|
if (!isPasswordValid)
|
|
63
65
|
throw new Error("Nome utente o password errata!");
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (this.accessiOptions.passwordExpiration &&
|
|
67
|
+
this.accessiOptions.passwordExpiration == true) {
|
|
68
|
+
const today = new Date();
|
|
69
|
+
const targetDate = new Date(utente.dataScadenzaPassword);
|
|
70
|
+
if (today >= targetDate) {
|
|
71
|
+
throw new Error("PASSWORD_EXPIRED");
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
// Recupera i grants
|
|
70
75
|
const userGrants = yield this.permissionService.getUserRolesAndGrants(utente.codiceUtente);
|
|
@@ -73,9 +78,12 @@ let AuthService = class AuthService {
|
|
|
73
78
|
const updateLastAccessDateQuery = "UPDATE UTENTI SET DATLASTLOGIN = CURRENT_TIMESTAMP WHERE CODUTE = ?";
|
|
74
79
|
yield Orm_1.Orm.query(this.accessiOptions.databaseOptions, updateLastAccessDateQuery, [utente.codiceUtente]);
|
|
75
80
|
let extensionFields = {};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
if (this.accessiOptions.extensionFieldsOptions &&
|
|
82
|
+
this.accessiOptions.extensionFieldsOptions.length > 0) {
|
|
83
|
+
for (const ext of this.accessiOptions.extensionFieldsOptions) {
|
|
84
|
+
const values = (yield Orm_1.Orm.query(ext.databaseOptions, `SELECT ${ext.tableFields.join(",")} FROM ${ext.tableName} WHERE ${ext.tableJoinFieldName} = ?`, [utente.codiceUtente])).map(Utilities_1.RestUtilities.convertKeysToCamelCase);
|
|
85
|
+
extensionFields[ext.objectKey] = values;
|
|
86
|
+
}
|
|
79
87
|
}
|
|
80
88
|
return { utente, filtri, userGrants, extensionFields };
|
|
81
89
|
});
|
|
@@ -4,6 +4,6 @@ export declare class EmailService {
|
|
|
4
4
|
constructor(accessiOptions: AccessiOptions);
|
|
5
5
|
sendAccountUpdateEmail(email: string, message: string): Promise<void>;
|
|
6
6
|
private transporter;
|
|
7
|
-
sendPasswordResetEmail(email: string): Promise<void>;
|
|
7
|
+
sendPasswordResetEmail(email: string, htmlMail?: string): Promise<void>;
|
|
8
8
|
private GetHtmlMail;
|
|
9
9
|
}
|
|
@@ -38,21 +38,33 @@ let EmailService = class EmailService {
|
|
|
38
38
|
sendAccountUpdateEmail(email, message) {
|
|
39
39
|
throw new Error('Method not implemented.');
|
|
40
40
|
}
|
|
41
|
-
sendPasswordResetEmail(email) {
|
|
41
|
+
sendPasswordResetEmail(email, htmlMail) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
var _a;
|
|
44
44
|
try {
|
|
45
45
|
const resetToken = (0, uuid_1.v4)(); // Generiamo un nuovo token unico
|
|
46
|
+
console.log('Generated reset token:', resetToken);
|
|
46
47
|
// Aggiorna il campo keyReg nel database
|
|
47
|
-
const result = yield Orm_1.Orm.
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const result = yield Orm_1.Orm.execute(this.accessiOptions.databaseOptions, 'UPDATE UTENTI SET KEYREG = ?, STAREG = ? WHERE USRNAME = ? ', [resetToken, StatoRegistrazione_1.StatoRegistrazione.INVIO, email]);
|
|
49
|
+
//costruizione dei queryparams
|
|
50
|
+
const returnUrlQueryParams = '?returnUrl=' +
|
|
51
|
+
this.accessiOptions.confirmationEmailReturnUrl +
|
|
52
|
+
'&prefix=' +
|
|
53
|
+
((_a = this.accessiOptions.confirmationEmailPrefix) !== null && _a !== void 0 ? _a : '');
|
|
54
|
+
const { confirmationEmailUrl, customResetPage } = this.accessiOptions;
|
|
55
|
+
// costruisco l'url di base
|
|
56
|
+
let resetUrl = `${confirmationEmailUrl}/api/accessi/email/reset-password-page/${resetToken}${returnUrlQueryParams}`;
|
|
57
|
+
//solo se gli do la customResetPage
|
|
58
|
+
if (customResetPage) {
|
|
59
|
+
resetUrl = customResetPage + '?token=' + resetToken;
|
|
50
60
|
}
|
|
51
|
-
const returnUrlQueryParams = "?returnUrl=" + this.accessiOptions.confirmationEmailReturnUrl + "&prefix=" + ((_a = this.accessiOptions.confirmationEmailPrefix) !== null && _a !== void 0 ? _a : '');
|
|
52
|
-
const { confirmationEmailUrl } = this.accessiOptions;
|
|
53
|
-
const resetUrl = `${confirmationEmailUrl}/api/accessi/email/reset-password-page/${resetToken}${returnUrlQueryParams}`;
|
|
54
61
|
let sPhrase;
|
|
55
|
-
|
|
62
|
+
if (htmlMail) {
|
|
63
|
+
sPhrase = htmlMail;
|
|
64
|
+
sPhrase.replace('#link_conferma_password_url', resetUrl);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
sPhrase = ` Gentile utente,<br>
|
|
56
68
|
abbiamo ricevuto la tua richiesta.<br><br>
|
|
57
69
|
|
|
58
70
|
Per completare l'operazione, clicca sul link qui sotto:<br>
|
|
@@ -64,11 +76,12 @@ let EmailService = class EmailService {
|
|
|
64
76
|
Questa è una comunicazione automatica, ti preghiamo di non rispondere a questa email.<br><br>
|
|
65
77
|
|
|
66
78
|
Grazie.<br>`;
|
|
79
|
+
}
|
|
67
80
|
const html = this.GetHtmlMail(sPhrase);
|
|
68
81
|
const mailOptions = {
|
|
69
82
|
from: this.accessiOptions.emailOptions.from,
|
|
70
83
|
to: email,
|
|
71
|
-
subject:
|
|
84
|
+
subject: 'Scelta nuova password',
|
|
72
85
|
text: sPhrase,
|
|
73
86
|
html: html,
|
|
74
87
|
};
|
|
@@ -192,7 +205,8 @@ let EmailService = class EmailService {
|
|
|
192
205
|
sTxt += ' table.kmSplitContentRightContentContainer,';
|
|
193
206
|
sTxt += ' table.kmColumnContainer,';
|
|
194
207
|
sTxt += ' td.kmVerticalButtonBarContentOuter table.kmButtonBarContent,';
|
|
195
|
-
sTxt +=
|
|
208
|
+
sTxt +=
|
|
209
|
+
' td.kmVerticalButtonCollectionContentOuter table.kmButtonCollectionContent,';
|
|
196
210
|
sTxt += ' table.kmVerticalButton,';
|
|
197
211
|
sTxt += ' table.kmVerticalButtonContent {';
|
|
198
212
|
sTxt += ' width: 100% !important';
|
|
@@ -272,44 +286,68 @@ let EmailService = class EmailService {
|
|
|
272
286
|
sTxt += ' }';
|
|
273
287
|
sTxt += ' </style>';
|
|
274
288
|
sTxt += '</head>';
|
|
275
|
-
sTxt +=
|
|
289
|
+
sTxt +=
|
|
290
|
+
'<body style="margin:0;padding:0;font-family:"Raleway", Helvetica, sans-serif;font-weight:400;letter-spacing:0.75px;line-height:180%;background-color:#F2F2F2">';
|
|
276
291
|
sTxt += ' <center>';
|
|
277
|
-
sTxt +=
|
|
292
|
+
sTxt +=
|
|
293
|
+
' <table align="center" border="0" cellpadding="0" cellspacing="0" id="bodyTable" width="100%" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;padding:0;background-color:#F2F2F2;height:100%;margin:0;width:100%">';
|
|
278
294
|
sTxt += ' <tbody>';
|
|
279
295
|
sTxt += ' <tr>';
|
|
280
|
-
sTxt +=
|
|
296
|
+
sTxt +=
|
|
297
|
+
' <td align="center" id="bodyCell" valign="top" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;padding-top:10px;padding-left:10px;padding-bottom:20px;padding-right:10px;border-top:0;height:100%;margin:0;width:100%">';
|
|
281
298
|
sTxt += ' <!--[if !mso]>';
|
|
282
299
|
sTxt += ' <!-->';
|
|
283
|
-
sTxt +=
|
|
300
|
+
sTxt +=
|
|
301
|
+
' <div class="templateContainer" style="border:0 none #aaa;background-color:#F2F2F2;border-radius:0;display: table; width:90%">';
|
|
284
302
|
sTxt += ' <div class="templateContainerInner" style="padding:0">';
|
|
285
303
|
sTxt += ' <!--';
|
|
286
304
|
sTxt += ' <![endif]-->';
|
|
287
305
|
sTxt += ' <!--[if mso]>';
|
|
288
|
-
sTxt +=
|
|
289
|
-
|
|
306
|
+
sTxt +=
|
|
307
|
+
' <table border="0" cellpadding="0" cellspacing="0" class="templateContainer" width="90%" ';
|
|
308
|
+
sTxt +=
|
|
309
|
+
' style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;">';
|
|
290
310
|
sTxt += ' <tbody>';
|
|
291
311
|
sTxt += ' <tr>';
|
|
292
|
-
sTxt +=
|
|
312
|
+
sTxt +=
|
|
313
|
+
' <td class="templateContainerInner" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;">';
|
|
293
314
|
sTxt += ' <![endif]-->';
|
|
294
|
-
sTxt +=
|
|
315
|
+
sTxt +=
|
|
316
|
+
' <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0">';
|
|
295
317
|
sTxt += ' <tr>';
|
|
296
|
-
sTxt +=
|
|
297
|
-
|
|
318
|
+
sTxt +=
|
|
319
|
+
' <td align="center" valign="top" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0">';
|
|
320
|
+
sTxt +=
|
|
321
|
+
' <table border="0" cellpadding="0" cellspacing="0" class="templateRow" width="100%" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0">';
|
|
298
322
|
sTxt += ' <tbody>';
|
|
299
323
|
sTxt += ' <tr>';
|
|
300
|
-
sTxt +=
|
|
301
|
-
|
|
302
|
-
sTxt +=
|
|
324
|
+
sTxt +=
|
|
325
|
+
' <td class="rowContainer kmFloatLeft" valign="top" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0">';
|
|
326
|
+
sTxt +=
|
|
327
|
+
' <table border="0" cellpadding="0" cellspacing="0" class="kmTextBlock" width="100%" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0">';
|
|
328
|
+
sTxt +=
|
|
329
|
+
' <tbody class="kmTextBlockOuter">';
|
|
303
330
|
sTxt += ' <tr>';
|
|
304
|
-
sTxt +=
|
|
305
|
-
|
|
306
|
-
sTxt +=
|
|
307
|
-
|
|
308
|
-
sTxt +=
|
|
309
|
-
|
|
310
|
-
sTxt +=
|
|
311
|
-
|
|
312
|
-
sTxt +=
|
|
331
|
+
sTxt +=
|
|
332
|
+
' <td class="kmTextBlockInner" valign="top" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;background-color:#FFFFFF;">';
|
|
333
|
+
sTxt +=
|
|
334
|
+
' <table align="left" border="0" cellpadding="0" cellspacing="0" class="kmTextContentContainer" width="100%" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0">';
|
|
335
|
+
sTxt +=
|
|
336
|
+
' <tbody>';
|
|
337
|
+
sTxt +=
|
|
338
|
+
' <tr>';
|
|
339
|
+
sTxt +=
|
|
340
|
+
' <td class="kmTextContent" valign="top" style="border-collapse:collapse;mso-table-lspace:0;mso-table-rspace:0;color:#272727;font-family:Helvetica, Arial;font-size:13px;line-height:200%;letter-spacing:normal;text-align:left;padding-top:40px;padding-bottom:40px;padding-left:40px;padding-right:40px;">';
|
|
341
|
+
sTxt +=
|
|
342
|
+
' <p>' +
|
|
343
|
+
sPhrase +
|
|
344
|
+
'<p>';
|
|
345
|
+
sTxt +=
|
|
346
|
+
' </td>';
|
|
347
|
+
sTxt +=
|
|
348
|
+
' </tr>';
|
|
349
|
+
sTxt +=
|
|
350
|
+
' </tbody>';
|
|
313
351
|
sTxt += ' </table>';
|
|
314
352
|
sTxt += ' </td>';
|
|
315
353
|
sTxt += ' </tr>';
|
|
@@ -89,6 +89,7 @@ let UserService = class UserService {
|
|
|
89
89
|
if (options.includeGrants)
|
|
90
90
|
userGrants = yield this.permissionService.getUserRolesAndGrants(user.codiceUtente);
|
|
91
91
|
let extensionFields = options.includeExtensionFields ? {} : null;
|
|
92
|
+
//todo: se non è prendente extensionFieldOptions va in errore. Risolvere il problema
|
|
92
93
|
if (options.includeExtensionFields) {
|
|
93
94
|
for (const ext of this.accessiOptions.extensionFieldsOptions) {
|
|
94
95
|
const values = (yield Orm_1.Orm.query(ext.databaseOptions, `SELECT ${ext.tableFields.join(",")} FROM ${ext.tableName} WHERE ${ext.tableJoinFieldName} = ?`, [user.codiceUtente])).map(Utilities_1.RestUtilities.convertKeysToCamelCase);
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|