emilsoftware-utilities 1.4.0-dev.1 → 1.4.0-dev.2
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 +32 -0
- package/dist/accessi-module/Controllers/EmailController.d.ts +2 -0
- package/dist/accessi-module/Controllers/EmailController.js +17 -2
- package/dist/accessi-module/Services/EmailService/EmailService.d.ts +1 -1
- package/dist/accessi-module/Services/EmailService/EmailService.js +12 -3
- package/dist/accessi-module/Services/UserService/UserService.js +1 -0
- package/dist/emilsoftware-utilities-1.4.0-dev.2.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,32 @@
|
|
|
1
|
+
1. feat: → nuova feature
|
|
2
|
+
Esempio: feat: aggiunta endpoint per notifiche
|
|
3
|
+
|
|
4
|
+
Triggera: MINOR release (1.3.0 → 1.4.0)
|
|
5
|
+
|
|
6
|
+
Su dev → 1.4.0-dev.0
|
|
7
|
+
|
|
8
|
+
2. fix: → correzione di bug
|
|
9
|
+
Esempio: fix: gestione errore null in login
|
|
10
|
+
|
|
11
|
+
Triggera: PATCH release (1.3.1)
|
|
12
|
+
|
|
13
|
+
Su dev → 1.3.1-dev.0
|
|
14
|
+
|
|
15
|
+
3. BREAKING CHANGE: (in descrizione o ! nel tipo)
|
|
16
|
+
Esempio:
|
|
17
|
+
```
|
|
18
|
+
bash
|
|
19
|
+
feat!: rimozione supporto legacy
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
BREAKING CHANGE: cambia lo schema JWT
|
|
23
|
+
Triggera: MAJOR release (1.0.0 → 2.0.0)
|
|
24
|
+
|
|
25
|
+
4. chore:, docs:, test:, refactor: ecc.
|
|
26
|
+
Esempio: chore: aggiorna dipendenze
|
|
27
|
+
|
|
28
|
+
Non triggerano release di default, a meno che tu non configuri esplicitamente nel commit-analyzer.
|
|
29
|
+
|
|
30
|
+
5. FORZA UNA RELEASE (utile in caso di merge ecc.):
|
|
31
|
+
- git commit --allow-empty -m "feat: trigger test release"
|
|
32
|
+
- git push origin dev OPPURE git push origin main
|
|
@@ -8,5 +8,7 @@ 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
|
+
resetUrlCustom?: string;
|
|
12
|
+
htmlMail?: string;
|
|
11
13
|
}, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
12
14
|
}
|
|
@@ -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.resetUrlCustom, sendResetPasswordData.htmlMail);
|
|
45
45
|
return Utilities_1.RestUtilities.sendOKMessage(res, "L'email di reset è stata inoltrata al destinatario.");
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
@@ -66,7 +66,22 @@ __decorate([
|
|
|
66
66
|
], EmailController.prototype, "serveResetPasswordPage", null);
|
|
67
67
|
__decorate([
|
|
68
68
|
(0, swagger_1.ApiOperation)({ summary: 'Invia una e-mail per il reset della password', operationId: "sendPasswordResetEmail" }),
|
|
69
|
-
(0, swagger_1.ApiBody)({ schema: { properties: {
|
|
69
|
+
(0, swagger_1.ApiBody)({ schema: { properties: {
|
|
70
|
+
email: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: "L'email dell'utente che richiede il reset"
|
|
73
|
+
},
|
|
74
|
+
resetCustomUrl: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
description: "Pagina di reset della password personalizzata",
|
|
77
|
+
},
|
|
78
|
+
htmlMail: {
|
|
79
|
+
type: 'string',
|
|
80
|
+
description: 'Corpo della mail in HTML'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
required: ['email']
|
|
84
|
+
} }),
|
|
70
85
|
(0, swagger_1.ApiResponse)({ status: 200, description: "L'email di reset è stata inviata con successo" }),
|
|
71
86
|
(0, swagger_1.ApiResponse)({ status: 400, description: "Errore nella richiesta: protocollo o host non impostati" }),
|
|
72
87
|
(0, swagger_1.ApiResponse)({ status: 500, description: "Errore interno durante l'invio dell'email" }),
|
|
@@ -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, resetUrlCustom?: string, htmlMail?: string): Promise<void>;
|
|
8
8
|
private GetHtmlMail;
|
|
9
9
|
}
|
|
@@ -38,7 +38,7 @@ 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, resetUrlCustom, htmlMail) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
var _a;
|
|
44
44
|
try {
|
|
@@ -50,9 +50,17 @@ let EmailService = class EmailService {
|
|
|
50
50
|
}
|
|
51
51
|
const returnUrlQueryParams = "?returnUrl=" + this.accessiOptions.confirmationEmailReturnUrl + "&prefix=" + ((_a = this.accessiOptions.confirmationEmailPrefix) !== null && _a !== void 0 ? _a : '');
|
|
52
52
|
const { confirmationEmailUrl } = this.accessiOptions;
|
|
53
|
-
|
|
53
|
+
let resetUrl = `${confirmationEmailUrl}/api/accessi/email/reset-password-page/${resetToken}${returnUrlQueryParams}`;
|
|
54
|
+
if (resetUrlCustom) {
|
|
55
|
+
resetUrl = resetUrlCustom + "?token=" + resetToken;
|
|
56
|
+
}
|
|
54
57
|
let sPhrase;
|
|
55
|
-
|
|
58
|
+
if (htmlMail) {
|
|
59
|
+
sPhrase = htmlMail;
|
|
60
|
+
sPhrase.replace('#link_conferma_password_url', resetUrl);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
sPhrase = ` Gentile utente,<br>
|
|
56
64
|
abbiamo ricevuto la tua richiesta.<br><br>
|
|
57
65
|
|
|
58
66
|
Per completare l'operazione, clicca sul link qui sotto:<br>
|
|
@@ -64,6 +72,7 @@ let EmailService = class EmailService {
|
|
|
64
72
|
Questa è una comunicazione automatica, ti preghiamo di non rispondere a questa email.<br><br>
|
|
65
73
|
|
|
66
74
|
Grazie.<br>`;
|
|
75
|
+
}
|
|
67
76
|
const html = this.GetHtmlMail(sPhrase);
|
|
68
77
|
const mailOptions = {
|
|
69
78
|
from: this.accessiOptions.emailOptions.from,
|
|
@@ -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
|