@hedhog/admin 0.51.20 → 0.51.21
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/dist/admin.module.d.ts.map +1 -1
- package/dist/admin.module.js +3 -0
- package/dist/admin.module.js.map +1 -1
- package/dist/auth/auth.controller.d.ts +6 -6
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +35 -24
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.module.d.ts.map +1 -1
- package/dist/auth/auth.module.js +2 -0
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/auth.service.d.ts +9 -9
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +38 -39
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +11 -11
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +11 -11
- package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
- package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
- package/dist/menu/menu.controller.d.ts +3 -3
- package/dist/menu/menu.service.d.ts +3 -3
- package/frontend/dashboard/components/create-panel.tsx.ejs +63 -63
- package/frontend/dashboard/components/dashboard.screen.tsx.ejs +116 -116
- package/frontend/dashboard/components/update-panel.tsx.ejs +80 -80
- package/frontend/dashboard/locales/en/dashboard.dashboard.json +11 -11
- package/frontend/dashboard/locales/pt/dashboard.dashboard.json +11 -11
- package/frontend/dashboard/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard/react-query/requests.ts.ejs +56 -56
- package/frontend/dashboard-component/components/create-panel.tsx.ejs +130 -130
- package/frontend/dashboard-component/components/update-panel.tsx.ejs +164 -164
- package/frontend/dashboard-component/locales/en/dashboard.dashboard-component.json +11 -11
- package/frontend/dashboard-component/locales/pt/dashboard.dashboard-component.json +11 -11
- package/frontend/dashboard-component/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-component/react-query/requests.ts.ejs +61 -61
- package/frontend/dashboard-item/components/create-panel.tsx.ejs +108 -108
- package/frontend/dashboard-item/components/update-panel.tsx.ejs +141 -141
- package/frontend/dashboard-item/locales/en/dashboard.dashboard-item.json +11 -11
- package/frontend/dashboard-item/locales/pt/dashboard.dashboard-item.json +11 -11
- package/frontend/dashboard-item/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-item/react-query/requests.ts.ejs +58 -58
- package/frontend/dashboard-user/components/create-panel.tsx.ejs +108 -108
- package/frontend/dashboard-user/components/update-panel.tsx.ejs +137 -137
- package/frontend/dashboard-user/locales/en/dashboard.dashboard-user.json +11 -11
- package/frontend/dashboard-user/locales/pt/dashboard.dashboard-user.json +11 -11
- package/frontend/dashboard-user/react-query/handlers.ts.ejs +28 -28
- package/frontend/dashboard-user/react-query/requests.ts.ejs +58 -58
- package/package.json +3 -1
- package/src/admin.module.ts +3 -0
- package/src/auth/auth.controller.ts +23 -10
- package/src/auth/auth.module.ts +2 -0
- package/src/auth/auth.service.ts +64 -60
- package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -55
- package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -36
- package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -4
- package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -4
- package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -4
- package/src/dashboard/index.ts +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"admin.module.d.ts","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"admin.module.d.ts","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":"AAkBA,qBAgCa,WAAW;CAAG"}
|
package/dist/admin.module.js
CHANGED
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.AdminModule = void 0;
|
10
10
|
const locale_1 = require("@hedhog/locale");
|
11
11
|
const mail_1 = require("@hedhog/mail");
|
12
|
+
const mail_manager_1 = require("@hedhog/mail-manager");
|
12
13
|
const pagination_1 = require("@hedhog/pagination");
|
13
14
|
const prisma_1 = require("@hedhog/prisma");
|
14
15
|
const axios_1 = require("@nestjs/axios");
|
@@ -34,6 +35,7 @@ exports.AdminModule = AdminModule = __decorate([
|
|
34
35
|
(0, common_1.forwardRef)(() => auth_module_1.AuthModule),
|
35
36
|
(0, common_1.forwardRef)(() => dashboard_module_1.DashboardModule),
|
36
37
|
(0, common_1.forwardRef)(() => mail_1.MailModule),
|
38
|
+
(0, common_1.forwardRef)(() => mail_manager_1.MailManagerModule),
|
37
39
|
(0, common_1.forwardRef)(() => menu_module_1.MenuModule),
|
38
40
|
(0, common_1.forwardRef)(() => pagination_1.PaginationModule),
|
39
41
|
(0, common_1.forwardRef)(() => role_module_1.RoleModule),
|
@@ -49,6 +51,7 @@ exports.AdminModule = AdminModule = __decorate([
|
|
49
51
|
user_module_1.UserModule,
|
50
52
|
auth_module_1.AuthModule,
|
51
53
|
mail_1.MailModule,
|
54
|
+
mail_manager_1.MailManagerModule,
|
52
55
|
route_module_1.RouteModule,
|
53
56
|
role_module_1.RoleModule,
|
54
57
|
menu_module_1.MenuModule,
|
package/dist/admin.module.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;AAC9C,uCAA0C;AAC1C,mDAAsD;AACtD,2CAA8C;AAC9C,yCAA2C;AAC3C,2CAAoD;AACpD,2CAA8C;AAC9C,oDAAgD;AAChD,oDAAgD;AAChD,mEAA+D;AAC/D,oDAAgD;AAChD,oDAAgD;AAChD,uDAAmD;AACnD,0DAAsD;AACtD,6DAAyD;AACzD,oDAAgD;
|
1
|
+
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../src/admin.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA8C;A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P,wBAAU;YACV,wBAAU;YACV,iBAAU;YACV,gCAAiB;YACjB,0BAAW;YACX,wBAAU;YACV,wBAAU;YACV,4BAAY;YACZ,qBAAY;YACZ,8BAAa;SACd;KACF,CAAC;GACW,WAAW,CAAG"}
|
@@ -16,7 +16,7 @@ export declare class AuthController {
|
|
16
16
|
id: number;
|
17
17
|
email: string;
|
18
18
|
}>;
|
19
|
-
createUser(data: CreateUserDTO): Promise<{
|
19
|
+
createUser(Locale: any, data: CreateUserDTO): Promise<{
|
20
20
|
token: string;
|
21
21
|
}>;
|
22
22
|
verify({ id }: UserType): Promise<{
|
@@ -29,7 +29,7 @@ export declare class AuthController {
|
|
29
29
|
email: string;
|
30
30
|
password: string;
|
31
31
|
}>;
|
32
|
-
login({ email, password }: LoginDTO): Promise<{
|
32
|
+
login(locale: string, { email, password }: LoginDTO): Promise<{
|
33
33
|
token: string;
|
34
34
|
} | {
|
35
35
|
token: string;
|
@@ -44,19 +44,19 @@ export declare class AuthController {
|
|
44
44
|
loginRecoveryCode({ token, code }: LoginWithCodeDTO): Promise<{
|
45
45
|
token: string;
|
46
46
|
}>;
|
47
|
-
forget({ email, }: ForgetDTO & {
|
47
|
+
forget(locale: string, { email, }: ForgetDTO & {
|
48
48
|
subject: string;
|
49
49
|
body: string;
|
50
50
|
}): Promise<{
|
51
51
|
message: string;
|
52
52
|
}>;
|
53
|
-
reset({ newPassword, confirmNewPassword, code }: ResetDTO): Promise<false | {
|
53
|
+
reset(locale: string, { newPassword, confirmNewPassword, code }: ResetDTO): Promise<false | {
|
54
54
|
token: string;
|
55
55
|
}>;
|
56
|
-
changePassword({ email, currentPassword, newPassword, confirmNewPassword }: ChangeDTO): Promise<{
|
56
|
+
changePassword(locale: string, { email, currentPassword, newPassword, confirmNewPassword }: ChangeDTO): Promise<{
|
57
57
|
token: string;
|
58
58
|
}>;
|
59
|
-
changeEmail({ currentEmail, password, newEmail }: EmailDTO): Promise<{
|
59
|
+
changeEmail(locale: string, { currentEmail, password, newEmail }: EmailDTO): Promise<{
|
60
60
|
token: string;
|
61
61
|
}>;
|
62
62
|
removeMfa({ id }: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErD,qBACa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,WAAW;IAKjC,eAAe,CAAgB,IAAI,EAAE,MAAM;;;;;IAM3C,UAAU,CAAW,MAAM,KAAA,EAAU,IAAI,EAAE,aAAa;;;IAMxD,MAAM,CAAS,EAAE,EAAE,EAAE,EAAE,QAAQ;;;;;;;;;;IAM/B,KAAK,CAAW,MAAM,EAAE,MAAM,EAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;IAMrE,QAAQ,CACJ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,WAAW;;;IAahE,SAAS,CAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,gBAAgB;;;IAMnD,iBAAiB,CAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,gBAAgB;;;IAM3D,MAAM,CACA,MAAM,EAAE,MAAM,EAExB,EACE,KAAK,GACN,EAAE,SAAS,GAAG;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd;;;IASG,KAAK,CACC,MAAM,EAAE,MAAM,EAChB,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,QAAQ;;;IAWvD,cAAc,CACR,MAAM,EAAE,MAAM,EAExB,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,SAAS;;;IAWlE,WAAW,CACL,MAAM,EAAE,MAAM,EAChB,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;IAUlD,SAAS,CAAS,EAAE,EAAE,EAAE;;KAAA,EAAU,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;;;IAK9D,WAAW,CAAS,EAAE,EAAE,EAAE;;KAAA;;;;IAK1B,SAAS,CAAS,EAAE,EAAE,EAAE;;KAAA,EAAU,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;;;IAO9D,WAAW,CAAQ,GAAG,KAAA;IAMtB,cAAc,CAAU,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;;;CAGzD"}
|
@@ -14,6 +14,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
exports.AuthController = void 0;
|
16
16
|
const core_1 = require("@hedhog/core");
|
17
|
+
const locale_1 = require("@hedhog/locale");
|
17
18
|
const common_1 = require("@nestjs/common");
|
18
19
|
const auth_service_1 = require("./auth.service");
|
19
20
|
const change_dto_1 = require("./dto/change.dto");
|
@@ -30,14 +31,14 @@ let AuthController = class AuthController {
|
|
30
31
|
async createUserCheck(code) {
|
31
32
|
return this.service.createUserCheck(code);
|
32
33
|
}
|
33
|
-
async createUser(data) {
|
34
|
-
return this.service.createUser(data);
|
34
|
+
async createUser(Locale, data) {
|
35
|
+
return this.service.createUser(Locale, data);
|
35
36
|
}
|
36
37
|
async verify({ id }) {
|
37
38
|
return this.service.verify(id);
|
38
39
|
}
|
39
|
-
async login({ email, password }) {
|
40
|
-
return this.service.login({ email, password });
|
40
|
+
async login(locale, { email, password }) {
|
41
|
+
return this.service.login(locale, { email, password });
|
41
42
|
}
|
42
43
|
async register({ email, password, name, code, multifactor_id }) {
|
43
44
|
return this.service.register({
|
@@ -54,28 +55,32 @@ let AuthController = class AuthController {
|
|
54
55
|
async loginRecoveryCode({ token, code }) {
|
55
56
|
return this.service.loginRecoveryCode({ token, code });
|
56
57
|
}
|
57
|
-
async forget({ email, }) {
|
58
|
-
return this.service.forget({
|
58
|
+
async forget(locale, { email, }) {
|
59
|
+
return this.service.forget(locale, {
|
59
60
|
email,
|
60
61
|
});
|
61
62
|
}
|
62
|
-
async reset({ newPassword, confirmNewPassword, code }) {
|
63
|
-
return this.service.resetPassword({
|
63
|
+
async reset(locale, { newPassword, confirmNewPassword, code }) {
|
64
|
+
return this.service.resetPassword(locale, {
|
64
65
|
newPassword,
|
65
66
|
confirmNewPassword,
|
66
67
|
code,
|
67
68
|
});
|
68
69
|
}
|
69
|
-
async changePassword({ email, currentPassword, newPassword, confirmNewPassword }) {
|
70
|
-
return this.service.changePassword({
|
70
|
+
async changePassword(locale, { email, currentPassword, newPassword, confirmNewPassword }) {
|
71
|
+
return this.service.changePassword(locale, {
|
71
72
|
email,
|
72
73
|
currentPassword,
|
73
74
|
newPassword,
|
74
75
|
confirmNewPassword,
|
75
76
|
});
|
76
77
|
}
|
77
|
-
async changeEmail({ currentEmail, password, newEmail }) {
|
78
|
-
return this.service.changeEmail(
|
78
|
+
async changeEmail(locale, { currentEmail, password, newEmail }) {
|
79
|
+
return this.service.changeEmail(locale, {
|
80
|
+
currentEmail,
|
81
|
+
password,
|
82
|
+
newEmail,
|
83
|
+
});
|
79
84
|
}
|
80
85
|
async removeMfa({ id }, { token }) {
|
81
86
|
return this.service.removeMfa(id, token);
|
@@ -106,9 +111,10 @@ __decorate([
|
|
106
111
|
__decorate([
|
107
112
|
(0, core_1.Public)(),
|
108
113
|
(0, common_1.Post)('create-user'),
|
109
|
-
__param(0, (0,
|
114
|
+
__param(0, (0, locale_1.Locale)()),
|
115
|
+
__param(1, (0, common_1.Body)()),
|
110
116
|
__metadata("design:type", Function),
|
111
|
-
__metadata("design:paramtypes", [create_user_dto_1.CreateUserDTO]),
|
117
|
+
__metadata("design:paramtypes", [Object, create_user_dto_1.CreateUserDTO]),
|
112
118
|
__metadata("design:returntype", Promise)
|
113
119
|
], AuthController.prototype, "createUser", null);
|
114
120
|
__decorate([
|
@@ -122,9 +128,10 @@ __decorate([
|
|
122
128
|
__decorate([
|
123
129
|
(0, core_1.Public)(),
|
124
130
|
(0, common_1.Post)('login'),
|
125
|
-
__param(0, (0,
|
131
|
+
__param(0, (0, locale_1.Locale)()),
|
132
|
+
__param(1, (0, common_1.Body)()),
|
126
133
|
__metadata("design:type", Function),
|
127
|
-
__metadata("design:paramtypes", [login_dto_1.LoginDTO]),
|
134
|
+
__metadata("design:paramtypes", [String, login_dto_1.LoginDTO]),
|
128
135
|
__metadata("design:returntype", Promise)
|
129
136
|
], AuthController.prototype, "login", null);
|
130
137
|
__decorate([
|
@@ -154,32 +161,36 @@ __decorate([
|
|
154
161
|
__decorate([
|
155
162
|
(0, core_1.Public)(),
|
156
163
|
(0, common_1.Post)('forget'),
|
157
|
-
__param(0, (0,
|
164
|
+
__param(0, (0, locale_1.Locale)()),
|
165
|
+
__param(1, (0, common_1.Body)()),
|
158
166
|
__metadata("design:type", Function),
|
159
|
-
__metadata("design:paramtypes", [Object]),
|
167
|
+
__metadata("design:paramtypes", [String, Object]),
|
160
168
|
__metadata("design:returntype", Promise)
|
161
169
|
], AuthController.prototype, "forget", null);
|
162
170
|
__decorate([
|
163
171
|
(0, core_1.Public)(),
|
164
172
|
(0, common_1.Post)('reset'),
|
165
|
-
__param(0, (0,
|
173
|
+
__param(0, (0, locale_1.Locale)()),
|
174
|
+
__param(1, (0, common_1.Body)()),
|
166
175
|
__metadata("design:type", Function),
|
167
|
-
__metadata("design:paramtypes", [reset_dto_1.ResetDTO]),
|
176
|
+
__metadata("design:paramtypes", [String, reset_dto_1.ResetDTO]),
|
168
177
|
__metadata("design:returntype", Promise)
|
169
178
|
], AuthController.prototype, "reset", null);
|
170
179
|
__decorate([
|
171
180
|
(0, core_1.Public)(),
|
172
181
|
(0, common_1.Post)('change-password'),
|
173
|
-
__param(0, (0,
|
182
|
+
__param(0, (0, locale_1.Locale)()),
|
183
|
+
__param(1, (0, common_1.Body)()),
|
174
184
|
__metadata("design:type", Function),
|
175
|
-
__metadata("design:paramtypes", [change_dto_1.ChangeDTO]),
|
185
|
+
__metadata("design:paramtypes", [String, change_dto_1.ChangeDTO]),
|
176
186
|
__metadata("design:returntype", Promise)
|
177
187
|
], AuthController.prototype, "changePassword", null);
|
178
188
|
__decorate([
|
179
189
|
(0, common_1.Post)('change-email'),
|
180
|
-
__param(0, (0,
|
190
|
+
__param(0, (0, locale_1.Locale)()),
|
191
|
+
__param(1, (0, common_1.Body)()),
|
181
192
|
__metadata("design:type", Function),
|
182
|
-
__metadata("design:paramtypes", [email_dto_1.EmailDTO]),
|
193
|
+
__metadata("design:paramtypes", [String, email_dto_1.EmailDTO]),
|
183
194
|
__metadata("design:returntype", Promise)
|
184
195
|
], AuthController.prototype, "changeEmail", null);
|
185
196
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;A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AErB,WAAA,IAAA,eAAM,GAAE,CAAA;IACR,WAAA,IAAA,aAAI,GAAE,CAAA;;6CACsD,sBAAS;;oDAQvE;AAGK;IADL,IAAA,aAAI,EAAC,cAAc,CAAC;IAElB,WAAA,IAAA,eAAM,GAAE,CAAA;IACR,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAuC,oBAAQ;;iDAOvD;AAGK;IADL,IAAA,eAAM,EAAC,YAAY,CAAC;IACJ,WAAA,IAAA,WAAI,GAAE,CAAA;IAAU,WAAA,IAAA,aAAI,GAAE,CAAA;;;;+CAEtC;AAGK;IADL,IAAA,aAAI,EAAC,cAAc,CAAC;IACF,WAAA,IAAA,WAAI,GAAE,CAAA;;;;iDAExB;AAGK;IADL,IAAA,aAAI,EAAC,YAAY,CAAC;IACF,WAAA,IAAA,WAAI,GAAE,CAAA;IAAU,WAAA,IAAA,aAAI,GAAE,CAAA;;;;+CAGtC;AAIK;IAFL,IAAA,aAAM,GAAE;IACR,IAAA,YAAG,EAAC,cAAc,CAAC;IACD,WAAA,IAAA,YAAG,GAAE,CAAA;;;;iDAEvB;AAIK;IAFL,IAAA,aAAM,GAAE;IACR,IAAA,YAAG,EAAC,iBAAiB,CAAC;IACD,WAAA,IAAA,cAAK,GAAE,CAAA;;;;oDAE5B;yBA3IU,cAAc;IAD1B,IAAA,mBAAU,EAAC,MAAM,CAAC;IAGd,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC,CAAC,CAAA;qCACZ,0BAAW;GAH5B,cAAc,CA4I1B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.module.d.ts","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"auth.module.d.ts","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":"AAaA,qBAiCa,UAAU;CAAG"}
|
package/dist/auth/auth.module.js
CHANGED
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
9
9
|
exports.AuthModule = void 0;
|
10
10
|
const mail_1 = require("@hedhog/mail");
|
11
|
+
const mail_manager_1 = require("@hedhog/mail-manager");
|
11
12
|
const prisma_1 = require("@hedhog/prisma");
|
12
13
|
const axios_1 = require("@nestjs/axios");
|
13
14
|
const common_1 = require("@nestjs/common");
|
@@ -38,6 +39,7 @@ exports.AuthModule = AuthModule = __decorate([
|
|
38
39
|
})),
|
39
40
|
(0, common_1.forwardRef)(() => prisma_1.PrismaModule),
|
40
41
|
(0, common_1.forwardRef)(() => mail_1.MailModule),
|
42
|
+
(0, common_1.forwardRef)(() => mail_manager_1.MailManagerModule),
|
41
43
|
(0, common_1.forwardRef)(() => setting_module_1.SettingModule),
|
42
44
|
config_1.ConfigModule,
|
43
45
|
axios_1.HttpModule,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA0C;AAC1C,2CAA8C;AAC9C,yCAA2C;AAC3C,2CAAoD;AACpD,2CAA8C;AAC9C,uCAAyC;AACzC,qCAAwC;AACxC,8DAA0D;AAC1D,uDAAmD;AACnD,iDAA6C;AAC7C,oDAAgD;
|
1
|
+
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA0C;AAC1C,uDAAyD;AACzD,2CAA8C;AAC9C,yCAA2C;AAC3C,2CAAoD;AACpD,2CAA8C;AAC9C,uCAAyC;AACzC,qCAAwC;AACxC,8DAA0D;AAC1D,uDAAmD;AACnD,iDAA6C;AAC7C,oDAAgD;AAmCzC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAjCtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CACd,eAAS,CAAC,aAAa,CAAC;gBACtB,MAAM,EAAE,IAAI;gBACZ,UAAU,EAAE,GAAG,EAAE;oBACf,OAAO;wBACL,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;wBACtC,MAAM,EAAE,IAAI;wBACZ,WAAW,EAAE;4BACX,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,KAAK;yBAC/C;qBACF,CAAC;gBACJ,CAAC;aACF,CAAC,CACH;YACD,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iBAAU,CAAC;YAC5B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gCAAiB,CAAC;YACnC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAa,CAAC;YAC/B,qBAAY;YACZ,kBAAU;SACX;QACD,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,SAAS,EAAE;YACT,0BAAW;YACX;gBACE,OAAO,EAAE,gBAAS;gBAClB,QAAQ,EAAE,sBAAS;aACpB;SACF;QACD,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAAG"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { MailService } from '@hedhog/mail';
|
1
|
+
import { MailService as MailManagerService } from '@hedhog/mail-manager';
|
2
2
|
import { PrismaService } from '@hedhog/prisma';
|
3
3
|
import { HttpService } from '@nestjs/axios';
|
4
4
|
import { OnModuleInit } from '@nestjs/common';
|
@@ -21,7 +21,7 @@ export declare class AuthService implements OnModuleInit {
|
|
21
21
|
private readonly mail;
|
22
22
|
private readonly setting;
|
23
23
|
settings: Record<string, any>;
|
24
|
-
constructor(httpService: HttpService, configService: ConfigService, prisma: PrismaService, jwt: JwtService, mail:
|
24
|
+
constructor(httpService: HttpService, configService: ConfigService, prisma: PrismaService, jwt: JwtService, mail: MailManagerService, setting: SettingService);
|
25
25
|
onModuleInit(): Promise<void>;
|
26
26
|
createUserCheck(code: string): Promise<{
|
27
27
|
name: string;
|
@@ -31,13 +31,13 @@ export declare class AuthService implements OnModuleInit {
|
|
31
31
|
register({ email, name, password, code, multifactor_id }: RegisterDTO): Promise<{
|
32
32
|
token: string;
|
33
33
|
}>;
|
34
|
-
createUser({ code, password, street, number, complement, district, city, state, postal_code, }: CreateUserDTO): Promise<{
|
34
|
+
createUser(locale: string, { code, password, street, number, complement, district, city, state, postal_code, }: CreateUserDTO): Promise<{
|
35
35
|
token: string;
|
36
36
|
}>;
|
37
37
|
verifyToken(token: string): Promise<any>;
|
38
38
|
generateRandomString(length: number): string;
|
39
39
|
generateRandomNumber(): number;
|
40
|
-
loginWithEmailAndPassword(email: string, password: string): Promise<{
|
40
|
+
loginWithEmailAndPassword(locale: string, email: string, password: string): Promise<{
|
41
41
|
token: string;
|
42
42
|
} | {
|
43
43
|
token: string;
|
@@ -46,16 +46,16 @@ export declare class AuthService implements OnModuleInit {
|
|
46
46
|
getToken(user: any): Promise<{
|
47
47
|
token: string;
|
48
48
|
}>;
|
49
|
-
forget({ email }: ForgetDTO): Promise<{
|
49
|
+
forget(locale: string, { email }: ForgetDTO): Promise<{
|
50
50
|
message: string;
|
51
51
|
}>;
|
52
|
-
changePassword({ email, currentPassword, newPassword, confirmNewPassword
|
52
|
+
changePassword(locale: string, { email, currentPassword, newPassword, confirmNewPassword }: ChangeDTO): Promise<{
|
53
53
|
token: string;
|
54
54
|
}>;
|
55
|
-
changeEmail({ currentEmail, password, newEmail }: EmailDTO): Promise<{
|
55
|
+
changeEmail(locale: string, { currentEmail, password, newEmail }: EmailDTO): Promise<{
|
56
56
|
token: string;
|
57
57
|
}>;
|
58
|
-
resetPassword({ code, newPassword, confirmNewPassword }: ResetDTO): Promise<false | {
|
58
|
+
resetPassword(locale: string, { code, newPassword, confirmNewPassword }: ResetDTO): Promise<false | {
|
59
59
|
token: string;
|
60
60
|
}>;
|
61
61
|
checkCodeMfa(userId: number, code: number): Promise<any>;
|
@@ -65,7 +65,7 @@ export declare class AuthService implements OnModuleInit {
|
|
65
65
|
loginCode({ token, code }: LoginWithCodeDTO): Promise<{
|
66
66
|
token: string;
|
67
67
|
}>;
|
68
|
-
login({ email, password }: LoginDTO): Promise<{
|
68
|
+
login(locale: string, { email, password }: LoginDTO): Promise<{
|
69
69
|
token: string;
|
70
70
|
} | {
|
71
71
|
token: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAOL,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,E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AM,EAAE,MAAM,EACd,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,SAAS;;;IAmClE,WAAW,CACf,MAAM,EAAE,MAAM,EACd,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;IA0D1C,aAAa,CACjB,MAAM,EAAE,MAAM,EACd,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,QAAQ;;;IAiD/C,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IA4BzC,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,gBAAgB;;;IA8CnD,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,gBAAgB;;;IAmD3C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;IAInD,MAAM,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;IAMjB,WAAW,CAAC,MAAM,EAAE,MAAM;;;;IAiDhC,qBAAqB,CAAC,KAAK,SAAK,GAAG,MAAM,EAAE;IAWrC,sBAAsB,CAAC,MAAM,EAAE,MAAM;IA6BrC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;;;IAoBvC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,UAAO;;;IA4CjE,WAAW,CAAC,GAAG,EAAE,GAAG;IAkBpB,cAAc,CAAC,IAAI,EAAE,MAAM;;;YAenB,gBAAgB;YAoBhB,kBAAkB;YAUlB,gBAAgB;CAkB/B"}
|
@@ -46,7 +46,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
46
46
|
};
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
48
48
|
exports.AuthService = void 0;
|
49
|
-
const
|
49
|
+
const mail_manager_1 = require("@hedhog/mail-manager");
|
50
50
|
const prisma_1 = require("@hedhog/prisma");
|
51
51
|
const axios_1 = require("@nestjs/axios");
|
52
52
|
const common_1 = require("@nestjs/common");
|
@@ -56,7 +56,6 @@ const bcrypt_1 = require("bcrypt");
|
|
56
56
|
const qrcode = __importStar(require("qrcode"));
|
57
57
|
const rxjs_1 = require("rxjs");
|
58
58
|
const speakeasy = __importStar(require("speakeasy"));
|
59
|
-
const emails_1 = require("../emails");
|
60
59
|
const setting_service_1 = require("../setting/setting.service");
|
61
60
|
const multifactor_type_enum_1 = require("./enums/multifactor-type.enum");
|
62
61
|
let AuthService = class AuthService {
|
@@ -125,7 +124,7 @@ let AuthService = class AuthService {
|
|
125
124
|
});
|
126
125
|
return this.getToken(newUser);
|
127
126
|
}
|
128
|
-
async createUser({ code, password, street, number, complement, district, city, state, postal_code, }) {
|
127
|
+
async createUser(locale, { code, password, street, number, complement, district, city, state, postal_code, }) {
|
129
128
|
try {
|
130
129
|
const user = await this.createUserCheck(code);
|
131
130
|
const salt = await (0, bcrypt_1.genSalt)();
|
@@ -185,12 +184,10 @@ let AuthService = class AuthService {
|
|
185
184
|
},
|
186
185
|
});
|
187
186
|
}
|
188
|
-
await this.mail.
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
name: user.name,
|
193
|
-
}),
|
187
|
+
await this.mail.sendTemplatedMail(locale, {
|
188
|
+
email: user.email,
|
189
|
+
slug: 'create-user',
|
190
|
+
variables: {},
|
194
191
|
});
|
195
192
|
return this.getToken(user);
|
196
193
|
}
|
@@ -217,7 +214,7 @@ let AuthService = class AuthService {
|
|
217
214
|
const max = 999999;
|
218
215
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
219
216
|
}
|
220
|
-
async loginWithEmailAndPassword(email, password) {
|
217
|
+
async loginWithEmailAndPassword(locale, email, password) {
|
221
218
|
const user = await this.prisma.user.findFirst({
|
222
219
|
where: {
|
223
220
|
email,
|
@@ -245,10 +242,10 @@ let AuthService = class AuthService {
|
|
245
242
|
code: String(code),
|
246
243
|
},
|
247
244
|
});
|
248
|
-
await this.mail.
|
249
|
-
|
250
|
-
|
251
|
-
|
245
|
+
await this.mail.sendTemplatedMail(locale, {
|
246
|
+
email: user.email,
|
247
|
+
slug: 'login',
|
248
|
+
variables: { code: String(code) },
|
252
249
|
});
|
253
250
|
return {
|
254
251
|
token: this.jwt.sign({
|
@@ -275,7 +272,7 @@ let AuthService = class AuthService {
|
|
275
272
|
token: this.jwt.sign(payload),
|
276
273
|
};
|
277
274
|
}
|
278
|
-
async forget({ email }) {
|
275
|
+
async forget(locale, { email }) {
|
279
276
|
var _a;
|
280
277
|
const appUrl = (_a = process.env.APP_URL) !== null && _a !== void 0 ? _a : this.configService.get('APP_URL');
|
281
278
|
const user = await this.prisma.user.findFirst({
|
@@ -297,17 +294,20 @@ let AuthService = class AuthService {
|
|
297
294
|
code,
|
298
295
|
},
|
299
296
|
});
|
300
|
-
await this.mail.
|
301
|
-
|
302
|
-
|
303
|
-
|
297
|
+
await this.mail.sendTemplatedMail(locale, {
|
298
|
+
email,
|
299
|
+
slug: 'forget',
|
300
|
+
variables: {
|
301
|
+
appUrl,
|
302
|
+
code,
|
303
|
+
},
|
304
304
|
});
|
305
305
|
}
|
306
306
|
return {
|
307
307
|
message: 'Se este e-mail estiver cadastrado, você receberá instruções para redefinir sua senha.',
|
308
308
|
};
|
309
309
|
}
|
310
|
-
async changePassword({ email, currentPassword, newPassword, confirmNewPassword
|
310
|
+
async changePassword(locale, { email, currentPassword, newPassword, confirmNewPassword }) {
|
311
311
|
if (newPassword !== confirmNewPassword) {
|
312
312
|
throw new common_1.BadRequestException('Senhas não conferem');
|
313
313
|
}
|
@@ -327,14 +327,14 @@ let AuthService = class AuthService {
|
|
327
327
|
password,
|
328
328
|
},
|
329
329
|
});
|
330
|
-
await this.mail.
|
331
|
-
|
332
|
-
|
333
|
-
|
330
|
+
await this.mail.sendTemplatedMail(locale, {
|
331
|
+
email,
|
332
|
+
slug: 'change-password',
|
333
|
+
variables: {},
|
334
334
|
});
|
335
335
|
return this.getToken(newUser);
|
336
336
|
}
|
337
|
-
async changeEmail({ currentEmail, password, newEmail }) {
|
337
|
+
async changeEmail(locale, { currentEmail, password, newEmail }) {
|
338
338
|
const user = await this.prisma.user.findFirst({
|
339
339
|
where: { email: currentEmail },
|
340
340
|
});
|
@@ -371,14 +371,14 @@ let AuthService = class AuthService {
|
|
371
371
|
},
|
372
372
|
data: { value: newEmail },
|
373
373
|
});
|
374
|
-
await this.mail.
|
375
|
-
|
376
|
-
|
377
|
-
|
374
|
+
await this.mail.sendTemplatedMail(locale, {
|
375
|
+
email: newEmail,
|
376
|
+
slug: 'change-email',
|
377
|
+
variables: {},
|
378
378
|
});
|
379
379
|
return this.getToken(newUser);
|
380
380
|
}
|
381
|
-
async resetPassword({ code, newPassword, confirmNewPassword }) {
|
381
|
+
async resetPassword(locale, { code, newPassword, confirmNewPassword }) {
|
382
382
|
var _a;
|
383
383
|
if (newPassword !== confirmNewPassword) {
|
384
384
|
throw new common_1.BadRequestException('Senhas não conferem');
|
@@ -404,10 +404,10 @@ let AuthService = class AuthService {
|
|
404
404
|
code: null,
|
405
405
|
},
|
406
406
|
});
|
407
|
-
await this.mail.
|
408
|
-
|
409
|
-
|
410
|
-
|
407
|
+
await this.mail.sendTemplatedMail(locale, {
|
408
|
+
email: user.email,
|
409
|
+
slug: 'reset-password',
|
410
|
+
variables: {},
|
411
411
|
});
|
412
412
|
return this.getToken(user);
|
413
413
|
}
|
@@ -448,7 +448,6 @@ let AuthService = class AuthService {
|
|
448
448
|
}
|
449
449
|
switch (data.mfa) {
|
450
450
|
case multifactor_type_enum_1.MultifactorType.EMAIL:
|
451
|
-
//TO DO
|
452
451
|
case multifactor_type_enum_1.MultifactorType.APP:
|
453
452
|
const codes = await this.prisma.user_code_recovery.findMany({
|
454
453
|
where: {
|
@@ -520,8 +519,8 @@ let AuthService = class AuthService {
|
|
520
519
|
return this.getToken(userApp);
|
521
520
|
}
|
522
521
|
}
|
523
|
-
async login({ email, password }) {
|
524
|
-
return this.loginWithEmailAndPassword(email, password);
|
522
|
+
async login(locale, { email, password }) {
|
523
|
+
return this.loginWithEmailAndPassword(locale, email, password);
|
525
524
|
}
|
526
525
|
async verify(id) {
|
527
526
|
return this.prisma.user.findUnique({
|
@@ -713,13 +712,13 @@ exports.AuthService = AuthService = __decorate([
|
|
713
712
|
(0, common_1.Injectable)(),
|
714
713
|
__param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
|
715
714
|
__param(3, (0, common_1.Inject)((0, common_1.forwardRef)(() => jwt_1.JwtService))),
|
716
|
-
__param(4, (0, common_1.Inject)((0, common_1.forwardRef)(() =>
|
715
|
+
__param(4, (0, common_1.Inject)((0, common_1.forwardRef)(() => mail_manager_1.MailService))),
|
717
716
|
__param(5, (0, common_1.Inject)((0, common_1.forwardRef)(() => setting_service_1.SettingService))),
|
718
717
|
__metadata("design:paramtypes", [axios_1.HttpService,
|
719
718
|
config_1.ConfigService,
|
720
719
|
prisma_1.PrismaService,
|
721
720
|
jwt_1.JwtService,
|
722
|
-
|
721
|
+
mail_manager_1.MailService,
|
723
722
|
setting_service_1.SettingService])
|
724
723
|
], AuthService);
|
725
724
|
//# sourceMappingURL=auth.service.js.map
|