emilsoftware-utilities 1.3.117 → 1.3.119

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.
@@ -29,6 +29,7 @@ export interface ExtensionFieldsOptions {
29
29
  }
30
30
  export interface AccessiOptions {
31
31
  databaseOptions: Options;
32
+ confirmationEmailReturnUrl: string;
32
33
  encryptionKey: string;
33
34
  mockDemoUser: boolean;
34
35
  jwtOptions: JwtOptions;
@@ -5,7 +5,7 @@ export declare class EmailController {
5
5
  private readonly emailService;
6
6
  private readonly options;
7
7
  constructor(emailService: EmailService, options: AccessiOptions);
8
- serveResetPasswordPage(res: Response, token: string): Promise<void>;
8
+ serveResetPasswordPage(res: Response, token: string, returnUrl?: string): Promise<void>;
9
9
  sendPasswordResetEmail(request: Request, sendResetPasswordData: {
10
10
  email: string;
11
11
  }, res: Response): Promise<Response<any, Record<string, any>>>;
@@ -20,6 +20,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  step((generator = generator.apply(thisArg, _arguments || [])).next());
21
21
  });
22
22
  };
23
+ var EmailController_1;
23
24
  Object.defineProperty(exports, "__esModule", { value: true });
24
25
  exports.EmailController = void 0;
25
26
  const common_1 = require("@nestjs/common");
@@ -27,13 +28,12 @@ const swagger_1 = require("@nestjs/swagger");
27
28
  const path_1 = require("path");
28
29
  const Utilities_1 = require("../../Utilities");
29
30
  const EmailService_1 = require("../Services/EmailService/EmailService");
30
- const AccessiController_1 = require("./AccessiController");
31
- let EmailController = class EmailController {
31
+ let EmailController = EmailController_1 = class EmailController {
32
32
  constructor(emailService, options) {
33
33
  this.emailService = emailService;
34
34
  this.options = options;
35
35
  }
36
- serveResetPasswordPage(res, token) {
36
+ serveResetPasswordPage(res, token, returnUrl) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  return res.sendFile((0, path_1.join)(__dirname, '..', 'Views', 'reset-password.html'));
39
39
  });
@@ -44,14 +44,14 @@ let EmailController = class EmailController {
44
44
  let protocol = request["protocol"];
45
45
  let host = request.headers["host"];
46
46
  if (!protocol || !host) {
47
- return Utilities_1.RestUtilities.sendErrorMessage(res, "Impossibile procedere: protocollo e host non impostati negli header della richiesta.", AccessiController_1.AccessiController.name);
47
+ throw new Error("Impossibile procedere: protocollo e host non impostati negli header della richiesta.");
48
48
  }
49
49
  let confirmationEmailPrefix = `${protocol}://${host}`;
50
50
  yield this.emailService.sendPasswordResetEmail(sendResetPasswordData.email, confirmationEmailPrefix);
51
51
  return Utilities_1.RestUtilities.sendOKMessage(res, "L'email di reset è stata inoltrata al destinatario.");
52
52
  }
53
53
  catch (error) {
54
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.AccessiController.name);
54
+ return Utilities_1.RestUtilities.sendErrorMessage(res, error, EmailController_1.name);
55
55
  }
56
56
  });
57
57
  }
@@ -60,12 +60,14 @@ exports.EmailController = EmailController;
60
60
  __decorate([
61
61
  (0, swagger_1.ApiOperation)({ summary: 'Serve una pagina per il reset della password', operationId: "serveResetPasswordPage" }),
62
62
  (0, swagger_1.ApiParam)({ name: 'token', description: 'Token per il reset della password', required: true }),
63
+ (0, swagger_1.ApiQuery)({ name: 'returnUrl', description: 'Url di ritorno della pagina. Default: https://google.com', required: false }),
63
64
  (0, swagger_1.ApiResponse)({ status: 200, description: 'Pagina di reset password servita con successo' }),
64
65
  (0, common_1.Get)('reset-password-page/:token'),
65
66
  __param(0, (0, common_1.Res)()),
66
67
  __param(1, (0, common_1.Param)('token')),
68
+ __param(2, (0, common_1.Query)('returnUrl')),
67
69
  __metadata("design:type", Function),
68
- __metadata("design:paramtypes", [Object, String]),
70
+ __metadata("design:paramtypes", [Object, String, String]),
69
71
  __metadata("design:returntype", Promise)
70
72
  ], EmailController.prototype, "serveResetPasswordPage", null);
71
73
  __decorate([
@@ -82,7 +84,7 @@ __decorate([
82
84
  __metadata("design:paramtypes", [Object, Object, Object]),
83
85
  __metadata("design:returntype", Promise)
84
86
  ], EmailController.prototype, "sendPasswordResetEmail", null);
85
- exports.EmailController = EmailController = __decorate([
87
+ exports.EmailController = EmailController = EmailController_1 = __decorate([
86
88
  (0, swagger_1.ApiTags)('Email'),
87
89
  (0, common_1.Controller)('accessi/email'),
88
90
  __param(1, (0, common_1.Inject)('ACCESSI_OPTIONS')),
@@ -74,10 +74,10 @@ let UserController = UserController_1 = class UserController {
74
74
  if (!protocol || !host) {
75
75
  throw new Error("Impossibile procedere: protocollo e host non impostati negli header della richiesta.");
76
76
  }
77
- yield this.userService.register(registrationData);
77
+ const users = yield this.userService.register(registrationData);
78
78
  let confirmationEmailPrefix = `${protocol}://${host}`;
79
79
  yield this.emailService.sendPasswordResetEmail(registrationData.email, confirmationEmailPrefix);
80
- return Utilities_1.RestUtilities.sendOKMessage(res, "L'utente è stato registrato con successo, email di conferma inoltrata al destinatario.");
80
+ return Utilities_1.RestUtilities.sendBaseResponse(res, users);
81
81
  }
82
82
  catch (error) {
83
83
  return Utilities_1.RestUtilities.sendErrorMessage(res, error, UserController_1.name);
@@ -47,7 +47,8 @@ let EmailService = class EmailService {
47
47
  if (result.length === 0) {
48
48
  throw new Error("Email non trovata.");
49
49
  }
50
- const resetUrl = `${baseUrl}/api/accessi/email/reset-password-page/${resetToken}`;
50
+ const returnUrlQueryParams = "?returnUrl=" + this.accessiOptions.confirmationEmailReturnUrl;
51
+ const resetUrl = `${baseUrl}/api/accessi/email/reset-password-page/${resetToken}${returnUrlQueryParams}`;
51
52
  const mailOptions = {
52
53
  from: this.accessiOptions.emailOptions.from,
53
54
  to: email,
@@ -144,6 +144,7 @@ let UserService = class UserService {
144
144
  if (!!registrationData.permissions && registrationData.permissions.length > 0) {
145
145
  yield this.permissionService.assignPermissionsToUser(codiceUtente, registrationData.permissions);
146
146
  }
147
+ return codiceUtente;
147
148
  }
148
149
  catch (error) {
149
150
  throw error;
@@ -103,7 +103,7 @@
103
103
  <h1>Reimposta la tua password</h1>
104
104
  <form id="resetForm">
105
105
  <input type="hidden" id="token" value="">
106
- <input type="hidden" id="redirectUrl" value="">
106
+ <input type="hidden" id="returnUrl" value="">
107
107
 
108
108
  <div class="form-group">
109
109
  <label for="password">Nuova Password:</label>
@@ -125,10 +125,10 @@
125
125
  document.addEventListener("DOMContentLoaded", function () {
126
126
  const urlParams = new URLSearchParams(window.location.search);
127
127
  const token = window.location.pathname.split("/").pop();
128
- const redirectUrl = urlParams.get("redirectUrl") || "/";
128
+ const returnUrl = urlParams.get("returnUrl") || "/";
129
129
 
130
130
  document.getElementById("token").value = token;
131
- document.getElementById("redirectUrl").value = redirectUrl;
131
+ document.getElementById("returnUrl").value = returnUrl;
132
132
 
133
133
  document.getElementById("resetForm").addEventListener("submit", async function (event) {
134
134
  event.preventDefault();
@@ -163,15 +163,26 @@
163
163
  const data = await response.json();
164
164
  alert(data.message || "Password aggiornata con successo!");
165
165
 
166
- if (response.ok) {
167
- window.location.href = redirectUrl;
168
- }
166
+
169
167
  } catch (error) {
170
168
  alert("Errore nel reset della password. Riprova più tardi.");
171
169
  }
170
+ finally {
171
+
172
+ setTimeout(() => {
173
+
174
+ if (returnUrl.startsWith("https://") || returnUrl.startsWith("http://")) {
175
+ window.location.href = returnUrl;
176
+ } else {
177
+ window.location.href = "https://" + returnUrl;
178
+ }
179
+
180
+ }, 500);
181
+
182
+ }
172
183
  });
173
184
  });
174
185
  </script>
175
186
  </body>
176
187
 
177
- </html>
188
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emilsoftware-utilities",
3
- "version": "1.3.117",
3
+ "version": "1.3.119",
4
4
  "description": "Utilities for EmilSoftware",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,33 +0,0 @@
1
- import { Response } from 'express';
2
- import { AccessiOptions } from '../AccessiModule';
3
- import { AuthService } from '../Services/AuthService/AuthService';
4
- import { PermissionService } from '../Services/PermissionService/PermissionService';
5
- import { UserService } from '../Services/UserService/UserService';
6
- import { EmailService } from '../Services/EmailService/EmailService';
7
- import { UserDto } from '../Dtos';
8
- export declare class AccessiController {
9
- private readonly userService;
10
- private readonly authService;
11
- private readonly emailService;
12
- private readonly permissionService;
13
- private readonly options;
14
- constructor(userService: UserService, authService: AuthService, emailService: EmailService, permissionService: PermissionService, options: AccessiOptions);
15
- serveResetPasswordPage(res: Response, token: string): Promise<void>;
16
- resetPassword(res: Response, token: string, newPassword: string): Promise<Response<any, Record<string, any>>>;
17
- getUserByToken(token: string, res: Response): Promise<Response<any, Record<string, any>>>;
18
- login(loginDto: {
19
- email: string;
20
- password: string;
21
- }, res: Response): Promise<Response<any, Record<string, any>>>;
22
- getUsers(res: Response): Promise<Response<any, Record<string, any>>>;
23
- deleteUser(codiceUtente: number, res: Response): Promise<Response<any, Record<string, any>>>;
24
- register(request: Request, registrationData: UserDto, res: Response): Promise<Response<any, Record<string, any>>>;
25
- encrypt(data: string, res: Response): Promise<Response<any, Record<string, any>>>;
26
- decrypt(data: string, res: Response): Promise<Response<any, Record<string, any>>>;
27
- resetAbilitazioni(codiceUtente: number, res: Response): Promise<Response<any, Record<string, any>>>;
28
- setPassword(request: {
29
- codiceUtente: number;
30
- nuovaPassword: string;
31
- }, res: Response): Promise<Response<any, Record<string, any>>>;
32
- setGdpr(codiceUtente: number, res: Response): Promise<Response<any, Record<string, any>>>;
33
- }
@@ -1,341 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- var __metadata = (this && this.__metadata) || function (k, v) {
42
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
- };
44
- var __param = (this && this.__param) || function (paramIndex, decorator) {
45
- return function (target, key) { decorator(target, key, paramIndex); }
46
- };
47
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
48
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
49
- return new (P || (P = Promise))(function (resolve, reject) {
50
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
51
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
52
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
53
- step((generator = generator.apply(thisArg, _arguments || [])).next());
54
- });
55
- };
56
- var AccessiController_1;
57
- Object.defineProperty(exports, "__esModule", { value: true });
58
- exports.AccessiController = void 0;
59
- const common_1 = require("@nestjs/common");
60
- const swagger_1 = require("@nestjs/swagger");
61
- const jwt = __importStar(require("jsonwebtoken"));
62
- const Utilities_1 = require("../../Utilities");
63
- const AuthService_1 = require("../Services/AuthService/AuthService");
64
- const PermissionService_1 = require("../Services/PermissionService/PermissionService");
65
- const UserService_1 = require("../Services/UserService/UserService");
66
- const EmailService_1 = require("../Services/EmailService/EmailService");
67
- const path_1 = require("path");
68
- const Dtos_1 = require("../Dtos");
69
- let AccessiController = AccessiController_1 = class AccessiController {
70
- constructor(userService, authService, emailService, permissionService, options) {
71
- this.userService = userService;
72
- this.authService = authService;
73
- this.emailService = emailService;
74
- this.permissionService = permissionService;
75
- this.options = options;
76
- }
77
- serveResetPasswordPage(res, token) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- return res.sendFile((0, path_1.join)(__dirname, '..', 'Views', 'reset-password.html'));
80
- });
81
- }
82
- resetPassword(res, token, newPassword) {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- try {
85
- yield this.authService.confirmResetPassword(token, newPassword);
86
- return Utilities_1.RestUtilities.sendOKMessage(res, 'Password aggiornata con successo!');
87
- }
88
- catch (error) {
89
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
90
- }
91
- });
92
- }
93
- getUserByToken(token, res) {
94
- return __awaiter(this, void 0, void 0, function* () {
95
- try {
96
- if (!token)
97
- return Utilities_1.RestUtilities.sendErrorMessage(res, 'Token non fornito', AccessiController_1.name);
98
- const decoded = jwt.verify(token, this.options.jwtOptions.secret);
99
- if (!decoded)
100
- return Utilities_1.RestUtilities.sendUnauthorized(res);
101
- return Utilities_1.RestUtilities.sendBaseResponse(res, { userData: decoded });
102
- }
103
- catch (error) {
104
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
105
- }
106
- });
107
- }
108
- login(loginDto, res) {
109
- return __awaiter(this, void 0, void 0, function* () {
110
- try {
111
- const userData = yield this.authService.login(loginDto);
112
- if (!userData)
113
- return Utilities_1.RestUtilities.sendInvalidCredentials(res);
114
- userData.token = {
115
- expiresIn: this.options.jwtOptions.expiresIn,
116
- value: jwt.sign({ userData }, this.options.jwtOptions.secret, { expiresIn: this.options.jwtOptions.expiresIn }),
117
- type: 'Bearer',
118
- };
119
- return Utilities_1.RestUtilities.sendBaseResponse(res, userData);
120
- }
121
- catch (error) {
122
- return Utilities_1.RestUtilities.sendInvalidCredentials(res);
123
- }
124
- });
125
- }
126
- getUsers(res) {
127
- return __awaiter(this, void 0, void 0, function* () {
128
- try {
129
- const users = yield this.userService.getUsers();
130
- return Utilities_1.RestUtilities.sendBaseResponse(res, users);
131
- }
132
- catch (error) {
133
- return Utilities_1.RestUtilities.sendInvalidCredentials(res);
134
- }
135
- });
136
- }
137
- deleteUser(codiceUtente, res) {
138
- return __awaiter(this, void 0, void 0, function* () {
139
- try {
140
- if (!codiceUtente)
141
- throw new Error('Il campo "Codice Utente" è obbligatorio.');
142
- yield this.userService.deleteUser(codiceUtente);
143
- return Utilities_1.RestUtilities.sendOKMessage(res, 'L\'utente è stato eliminato con successo.');
144
- }
145
- catch (error) {
146
- return Utilities_1.RestUtilities.sendErrorMessage(res, error);
147
- }
148
- });
149
- }
150
- register(request, registrationData, res) {
151
- return __awaiter(this, void 0, void 0, function* () {
152
- try {
153
- let protocol = request["protocol"];
154
- let host = request.headers["host"];
155
- if (!protocol || !host) {
156
- return Utilities_1.RestUtilities.sendErrorMessage(res, "Impossibile procedere: protocollo e host non impostati negli header della richiesta.", AccessiController_1.name);
157
- }
158
- yield this.userService.register(registrationData);
159
- let confirmationEmailPrefix = protocol + "://" + host;
160
- yield this.emailService.sendPasswordResetEmail(registrationData.email, confirmationEmailPrefix);
161
- return Utilities_1.RestUtilities.sendOKMessage(res, "L'utente è stato registrato con successo, email di conferma inoltrata al destinatario.");
162
- }
163
- catch (error) {
164
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
165
- }
166
- });
167
- }
168
- encrypt(data, res) {
169
- return __awaiter(this, void 0, void 0, function* () {
170
- try {
171
- const encryptedData = Utilities_1.CryptUtilities.encrypt(data, this.options.encryptionKey);
172
- return Utilities_1.RestUtilities.sendBaseResponse(res, encryptedData);
173
- }
174
- catch (error) {
175
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
176
- }
177
- });
178
- }
179
- decrypt(data, res) {
180
- return __awaiter(this, void 0, void 0, function* () {
181
- try {
182
- const decryptedData = Utilities_1.CryptUtilities.decrypt(data, this.options.encryptionKey);
183
- return Utilities_1.RestUtilities.sendBaseResponse(res, decryptedData);
184
- }
185
- catch (error) {
186
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
187
- }
188
- });
189
- }
190
- resetAbilitazioni(codiceUtente, res) {
191
- return __awaiter(this, void 0, void 0, function* () {
192
- try {
193
- yield this.permissionService.resetAbilitazioni(codiceUtente);
194
- return Utilities_1.RestUtilities.sendOKMessage(res, `Le abilitazioni dell'utente ${codiceUtente} sono state resettate con successo.`);
195
- }
196
- catch (error) {
197
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
198
- }
199
- });
200
- }
201
- setPassword(request, res) {
202
- return __awaiter(this, void 0, void 0, function* () {
203
- try {
204
- yield this.authService.setPassword(request.codiceUtente, request.nuovaPassword);
205
- return Utilities_1.RestUtilities.sendOKMessage(res, `La password dell'utente ${request.codiceUtente} è stata impostata correttamente.`);
206
- }
207
- catch (error) {
208
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
209
- }
210
- });
211
- }
212
- setGdpr(codiceUtente, res) {
213
- return __awaiter(this, void 0, void 0, function* () {
214
- try {
215
- yield this.userService.setGdpr(codiceUtente);
216
- return Utilities_1.RestUtilities.sendOKMessage(res, `L'utente ${codiceUtente} ha accettato il GDPR.`);
217
- }
218
- catch (error) {
219
- return Utilities_1.RestUtilities.sendErrorMessage(res, error, AccessiController_1.name);
220
- }
221
- });
222
- }
223
- };
224
- exports.AccessiController = AccessiController;
225
- __decorate([
226
- (0, common_1.Get)('reset-password/:token'),
227
- __param(0, (0, common_1.Res)()),
228
- __param(1, (0, common_1.Param)('token')),
229
- __metadata("design:type", Function),
230
- __metadata("design:paramtypes", [Object, String]),
231
- __metadata("design:returntype", Promise)
232
- ], AccessiController.prototype, "serveResetPasswordPage", null);
233
- __decorate([
234
- (0, common_1.Post)('reset-password/:token'),
235
- __param(0, (0, common_1.Res)()),
236
- __param(1, (0, common_1.Param)('token')),
237
- __param(2, (0, common_1.Body)("newPassword")),
238
- __metadata("design:type", Function),
239
- __metadata("design:paramtypes", [Object, String, String]),
240
- __metadata("design:returntype", Promise)
241
- ], AccessiController.prototype, "resetPassword", null);
242
- __decorate([
243
- (0, swagger_1.ApiOperation)({ summary: 'Recupera le informazioni utente dal token JWT', operationId: "getUserByToken" }),
244
- (0, common_1.Post)('get-user-by-token'),
245
- __param(0, (0, common_1.Body)('token')),
246
- __param(1, (0, common_1.Res)()),
247
- __metadata("design:type", Function),
248
- __metadata("design:paramtypes", [String, Object]),
249
- __metadata("design:returntype", Promise)
250
- ], AccessiController.prototype, "getUserByToken", null);
251
- __decorate([
252
- (0, swagger_1.ApiOperation)({ summary: 'Effettua il login', operationId: "login" }),
253
- (0, common_1.Post)('login'),
254
- __param(0, (0, common_1.Body)()),
255
- __param(1, (0, common_1.Res)()),
256
- __metadata("design:type", Function),
257
- __metadata("design:paramtypes", [Object, Object]),
258
- __metadata("design:returntype", Promise)
259
- ], AccessiController.prototype, "login", null);
260
- __decorate([
261
- (0, swagger_1.ApiOperation)({ summary: 'Recupera la lista degli utenti', operationId: "getUsers" }),
262
- (0, common_1.Post)('get-users'),
263
- __param(0, (0, common_1.Res)()),
264
- __metadata("design:type", Function),
265
- __metadata("design:paramtypes", [Object]),
266
- __metadata("design:returntype", Promise)
267
- ], AccessiController.prototype, "getUsers", null);
268
- __decorate([
269
- (0, swagger_1.ApiOperation)({ summary: 'Elimina un utente', operationId: "deleteUser" }),
270
- (0, common_1.Post)('delete-user'),
271
- __param(0, (0, common_1.Body)('codiceUtente')),
272
- __param(1, (0, common_1.Res)()),
273
- __metadata("design:type", Function),
274
- __metadata("design:paramtypes", [Number, Object]),
275
- __metadata("design:returntype", Promise)
276
- ], AccessiController.prototype, "deleteUser", null);
277
- __decorate([
278
- (0, swagger_1.ApiOperation)({ summary: 'Registra un nuovo utente', operationId: "register" }),
279
- (0, common_1.Post)('register'),
280
- __param(0, (0, common_1.Req)()),
281
- __param(1, (0, common_1.Body)()),
282
- __param(2, (0, common_1.Res)()),
283
- __metadata("design:type", Function),
284
- __metadata("design:paramtypes", [Request, Dtos_1.UserDto, Object]),
285
- __metadata("design:returntype", Promise)
286
- ], AccessiController.prototype, "register", null);
287
- __decorate([
288
- (0, swagger_1.ApiOperation)({ summary: 'Crittografa i dati', operationId: "encrypt" }),
289
- (0, common_1.Post)('encrypt'),
290
- __param(0, (0, common_1.Body)('data')),
291
- __param(1, (0, common_1.Res)()),
292
- __metadata("design:type", Function),
293
- __metadata("design:paramtypes", [String, Object]),
294
- __metadata("design:returntype", Promise)
295
- ], AccessiController.prototype, "encrypt", null);
296
- __decorate([
297
- (0, swagger_1.ApiOperation)({ summary: 'Decrittografa i dati', operationId: "decrypt" }),
298
- (0, common_1.Post)('decrypt'),
299
- __param(0, (0, common_1.Body)('data')),
300
- __param(1, (0, common_1.Res)()),
301
- __metadata("design:type", Function),
302
- __metadata("design:paramtypes", [String, Object]),
303
- __metadata("design:returntype", Promise)
304
- ], AccessiController.prototype, "decrypt", null);
305
- __decorate([
306
- (0, swagger_1.ApiOperation)({ summary: 'Resetta le abilitazioni di un utente', operationId: "resetAbilitazioni" }),
307
- (0, common_1.Post)('reset-abilitazioni'),
308
- __param(0, (0, common_1.Body)('codiceUtente')),
309
- __param(1, (0, common_1.Res)()),
310
- __metadata("design:type", Function),
311
- __metadata("design:paramtypes", [Number, Object]),
312
- __metadata("design:returntype", Promise)
313
- ], AccessiController.prototype, "resetAbilitazioni", null);
314
- __decorate([
315
- (0, swagger_1.ApiOperation)({ summary: 'Imposta una nuova password', operationId: "setPassword" }),
316
- (0, common_1.Post)('set-password'),
317
- __param(0, (0, common_1.Body)()),
318
- __param(1, (0, common_1.Res)()),
319
- __metadata("design:type", Function),
320
- __metadata("design:paramtypes", [Object, Object]),
321
- __metadata("design:returntype", Promise)
322
- ], AccessiController.prototype, "setPassword", null);
323
- __decorate([
324
- (0, swagger_1.ApiOperation)({ summary: 'Imposta il consenso GDPR', operationId: "setGdpr" }),
325
- (0, common_1.Post)('set-gdpr'),
326
- __param(0, (0, common_1.Body)('codiceUtente')),
327
- __param(1, (0, common_1.Res)()),
328
- __metadata("design:type", Function),
329
- __metadata("design:paramtypes", [Number, Object]),
330
- __metadata("design:returntype", Promise)
331
- ], AccessiController.prototype, "setGdpr", null);
332
- exports.AccessiController = AccessiController = AccessiController_1 = __decorate([
333
- (0, Utilities_1.Deprecated)("AccessiController è deprecato. Usa i controller specifici per ogni area."),
334
- (0, swagger_1.ApiTags)('AccessiDEPRECATED'),
335
- (0, common_1.Controller)('accessi'),
336
- __param(4, (0, common_1.Inject)('ACCESSI_OPTIONS')),
337
- __metadata("design:paramtypes", [UserService_1.UserService,
338
- AuthService_1.AuthService,
339
- EmailService_1.EmailService,
340
- PermissionService_1.PermissionService, Object])
341
- ], AccessiController);