@hedhog/admin 0.7.4 → 0.7.5
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/auth/auth.controller.d.ts +6 -1
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +23 -4
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.service.d.ts +9 -1
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +31 -4
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/dto/reset.dto.d.ts +6 -0
- package/dist/auth/dto/reset.dto.d.ts.map +1 -0
- package/dist/auth/dto/reset.dto.js +31 -0
- package/dist/auth/dto/reset.dto.js.map +1 -0
- package/dist/menu/menu.controller.d.ts +6 -6
- package/dist/menu/menu.service.d.ts +6 -6
- package/dist/role/role.controller.d.ts +10 -10
- package/dist/role/role.service.d.ts +10 -10
- package/dist/route/route.controller.d.ts +6 -6
- package/dist/route/route.service.d.ts +6 -6
- package/dist/screen/screen.controller.d.ts +6 -6
- package/dist/screen/screen.service.d.ts +6 -6
- package/dist/user/user.controller.d.ts +4 -4
- package/dist/user/user.service.d.ts +4 -4
- package/package.json +43 -43
- package/src/auth/auth.controller.ts +29 -3
- package/src/auth/auth.service.ts +64 -6
- package/src/auth/dto/reset.dto.ts +14 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
import { AuthService } from './auth.service';
|
2
2
|
import { ForgetDTO } from './dto/forget.dto';
|
3
|
+
import { ResetDTO } from './dto/reset.dto';
|
3
4
|
import { LoginDTO } from './dto/login.dto';
|
4
5
|
import { OtpDTO } from './dto/otp.dto';
|
5
6
|
import { User as UserType } from './types/user.type';
|
@@ -16,6 +17,10 @@ export declare class AuthController {
|
|
16
17
|
otp({ token, code }: OtpDTO): Promise<{
|
17
18
|
token: string;
|
18
19
|
}>;
|
19
|
-
forget({ email }: ForgetDTO
|
20
|
+
forget({ email, subject, body, }: ForgetDTO & {
|
21
|
+
subject: string;
|
22
|
+
body: string;
|
23
|
+
}): Promise<boolean>;
|
24
|
+
reset({ newPassword, confirmNewPassword, code, }: ResetDTO): Promise<boolean>;
|
20
25
|
}
|
21
26
|
//# sourceMappingURL=auth.controller.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErD,qBACa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,WAAW;IAKjC,MAAM,CAAS,EAAE,EAAE,EAAE,EAAE,QAAQ;IAM/B,KAAK,CAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;IAM3C,GAAG,CAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM;;;IAMnC,MAAM,CAAS,
|
1
|
+
{"version":3,"file":"auth.controller.d.ts","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErD,qBACa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,WAAW;IAKjC,MAAM,CAAS,EAAE,EAAE,EAAE,EAAE,QAAQ;IAM/B,KAAK,CAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;IAM3C,GAAG,CAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM;;;IAMnC,MAAM,CAAS,EACnB,KAAK,EACL,OAAO,EACP,IAAI,GACL,EAAE,SAAS,GAAG;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd;IAUK,KAAK,CAAS,EAClB,WAAW,EACX,kBAAkB,EAClB,IAAI,GACL,EAAE,QAAQ;CAOZ"}
|
@@ -16,7 +16,7 @@ exports.AuthController = void 0;
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
17
17
|
const core_1 = require("@hedhog/core");
|
18
18
|
const auth_service_1 = require("./auth.service");
|
19
|
-
const
|
19
|
+
const reset_dto_1 = require("./dto/reset.dto");
|
20
20
|
const login_dto_1 = require("./dto/login.dto");
|
21
21
|
const otp_dto_1 = require("./dto/otp.dto");
|
22
22
|
let AuthController = class AuthController {
|
@@ -32,8 +32,19 @@ let AuthController = class AuthController {
|
|
32
32
|
async otp({ token, code }) {
|
33
33
|
return this.service.otp({ token, code });
|
34
34
|
}
|
35
|
-
async forget({ email }) {
|
36
|
-
return this.service.forget({
|
35
|
+
async forget({ email, subject, body, }) {
|
36
|
+
return this.service.forget({
|
37
|
+
email,
|
38
|
+
subject,
|
39
|
+
body,
|
40
|
+
});
|
41
|
+
}
|
42
|
+
async reset({ newPassword, confirmNewPassword, code, }) {
|
43
|
+
return this.service.resetPassword({
|
44
|
+
newPassword,
|
45
|
+
confirmNewPassword,
|
46
|
+
code,
|
47
|
+
});
|
37
48
|
}
|
38
49
|
};
|
39
50
|
exports.AuthController = AuthController;
|
@@ -66,9 +77,17 @@ __decorate([
|
|
66
77
|
(0, common_1.Post)('forget'),
|
67
78
|
__param(0, (0, common_1.Body)()),
|
68
79
|
__metadata("design:type", Function),
|
69
|
-
__metadata("design:paramtypes", [
|
80
|
+
__metadata("design:paramtypes", [Object]),
|
70
81
|
__metadata("design:returntype", Promise)
|
71
82
|
], AuthController.prototype, "forget", null);
|
83
|
+
__decorate([
|
84
|
+
(0, core_1.Public)(),
|
85
|
+
(0, common_1.Post)('reset'),
|
86
|
+
__param(0, (0, common_1.Body)()),
|
87
|
+
__metadata("design:type", Function),
|
88
|
+
__metadata("design:paramtypes", [reset_dto_1.ResetDTO]),
|
89
|
+
__metadata("design:returntype", Promise)
|
90
|
+
], AuthController.prototype, "reset", null);
|
72
91
|
exports.AuthController = AuthController = __decorate([
|
73
92
|
(0, common_1.Controller)('auth'),
|
74
93
|
__param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => auth_service_1.AuthService))),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAOwB;AACxB,uCAAkD;AAClD,iDAA6C;
|
1
|
+
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/auth/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAOwB;AACxB,uCAAkD;AAClD,iDAA6C;AAE7C,+CAA2C;AAC3C,+CAA2C;AAC3C,2CAAuC;AAIhC,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IACnC,CAAC;IAIC,AAAN,KAAK,CAAC,MAAM,CAAS,EAAE,EAAE,EAAY;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAIK,AAAN,KAAK,CAAC,KAAK,CAAS,EAAE,KAAK,EAAE,QAAQ,EAAY;QAC/C,OAAO,IAAI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A;;qCAIhB,oBAAQ;;2CAMV;yBArDU,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,CAsD1B"}
|
@@ -21,7 +21,15 @@ export declare class AuthService {
|
|
21
21
|
getToken(user: any): Promise<{
|
22
22
|
token: string;
|
23
23
|
}>;
|
24
|
-
forget({ email }: ForgetDTO
|
24
|
+
forget({ email, subject, body, }: ForgetDTO & {
|
25
|
+
subject?: string;
|
26
|
+
body?: string;
|
27
|
+
}): Promise<boolean>;
|
28
|
+
resetPassword({ code, newPassword, confirmNewPassword, }: {
|
29
|
+
code: string;
|
30
|
+
newPassword: string;
|
31
|
+
confirmNewPassword: string;
|
32
|
+
}): Promise<boolean>;
|
25
33
|
otp({ token, code }: OtpDTO): Promise<{
|
26
34
|
token: string;
|
27
35
|
}>;
|
@@ -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,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAQ/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,qBACa,WAAW;IAGpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAEpB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAJJ,MAAM,EAAE,aAAa,EAErB,GAAG,EAAE,UAAU,EAEf,IAAI,EAAE,WAAW;IAG9B,WAAW,CAAC,KAAK,EAAE,MAAM;IAM/B,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAW5C,oBAAoB,IAAI,MAAM;IAMxB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;IAgDzD,QAAQ,CAAC,IAAI,KAAA;;;IAUb,MAAM,CAAC,EACX,KAAK,EACL,OAAO,EACP,IAAI,GACL,EAAE,SAAS,GAAG;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAsCK,aAAa,CAAC,EAClB,IAAI,EACJ,WAAW,EACX,kBAAkB,GACnB,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE,MAAM,CAAC;KAC5B;IAqCK,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM;;;IA0BjC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ;;;;;;IAInC,MAAM,CAAC,EAAE,EAAE,MAAM;CAGlB"}
|
@@ -93,7 +93,7 @@ let AuthService = class AuthService {
|
|
93
93
|
token: this.jwt.sign(payload),
|
94
94
|
};
|
95
95
|
}
|
96
|
-
async forget({ email }) {
|
96
|
+
async forget({ email, subject, body, }) {
|
97
97
|
const user = await this.prisma.user.findFirst({
|
98
98
|
where: {
|
99
99
|
email,
|
@@ -105,7 +105,8 @@ let AuthService = class AuthService {
|
|
105
105
|
if (!user) {
|
106
106
|
throw new common_1.NotFoundException('User not found');
|
107
107
|
}
|
108
|
-
const
|
108
|
+
const payload = Object.assign({}, user);
|
109
|
+
const code = this.jwt.sign(payload);
|
109
110
|
await this.prisma.user.update({
|
110
111
|
where: {
|
111
112
|
id: user.id,
|
@@ -116,11 +117,37 @@ let AuthService = class AuthService {
|
|
116
117
|
});
|
117
118
|
await this.mail.send({
|
118
119
|
to: email,
|
119
|
-
subject: 'Reset password',
|
120
|
-
body: `Reset your password by clicking <a href="${process.env.FRONTEND_URL}/
|
120
|
+
subject: subject !== null && subject !== void 0 ? subject : 'Reset password',
|
121
|
+
body: body !== null && body !== void 0 ? body : `Reset your password by clicking <a href="${process.env.FRONTEND_URL}/password-recovery/${code}">here</a>`,
|
121
122
|
});
|
122
123
|
return true;
|
123
124
|
}
|
125
|
+
async resetPassword({ code, newPassword, confirmNewPassword, }) {
|
126
|
+
if (newPassword !== confirmNewPassword) {
|
127
|
+
throw new common_1.BadRequestException("Passwords don't match");
|
128
|
+
}
|
129
|
+
const { id } = this.jwt.decode(code);
|
130
|
+
const user = await this.prisma.user.findFirst({
|
131
|
+
where: {
|
132
|
+
id,
|
133
|
+
code,
|
134
|
+
},
|
135
|
+
});
|
136
|
+
if (user) {
|
137
|
+
const salt = await (0, bcrypt_1.genSalt)();
|
138
|
+
const password = await (0, bcrypt_1.hash)(confirmNewPassword, salt);
|
139
|
+
await this.prisma.user.update({
|
140
|
+
where: {
|
141
|
+
id: user.id,
|
142
|
+
},
|
143
|
+
data: {
|
144
|
+
password,
|
145
|
+
},
|
146
|
+
});
|
147
|
+
return true;
|
148
|
+
}
|
149
|
+
return false;
|
150
|
+
}
|
124
151
|
async otp({ token, code }) {
|
125
152
|
const data = this.jwt.decode(token);
|
126
153
|
const user = await this.prisma.user.findFirst({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAA2C;AAC3C,2CAA+C;AAC/C,
|
1
|
+
{"version":3,"file":"auth.service.js","sourceRo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
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
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;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.ResetDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class ResetDTO {
|
15
|
+
}
|
16
|
+
exports.ResetDTO = ResetDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsNotEmpty)(),
|
19
|
+
(0, class_validator_1.MinLength)(8),
|
20
|
+
__metadata("design:type", String)
|
21
|
+
], ResetDTO.prototype, "newPassword", void 0);
|
22
|
+
__decorate([
|
23
|
+
(0, class_validator_1.IsNotEmpty)(),
|
24
|
+
(0, class_validator_1.MinLength)(8),
|
25
|
+
__metadata("design:type", String)
|
26
|
+
], ResetDTO.prototype, "confirmNewPassword", void 0);
|
27
|
+
__decorate([
|
28
|
+
(0, class_validator_1.IsNotEmpty)(),
|
29
|
+
__metadata("design:type", String)
|
30
|
+
], ResetDTO.prototype, "code", void 0);
|
31
|
+
//# sourceMappingURL=reset.dto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"reset.dto.js","sourceRoot":"","sources":["../../../src/auth/dto/reset.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwD;AAExD,MAAa,QAAQ;CAWpB;AAXD,4BAWC;AARG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,CAAC,CAAC;;6CACO;AAIpB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,EAAC,CAAC,CAAC;;oDACc;AAG3B;IADC,IAAA,4BAAU,GAAE;;sCACA"}
|
@@ -11,31 +11,31 @@ export declare class MenuController {
|
|
11
11
|
id: any;
|
12
12
|
}, locale: any): Promise<any[]>;
|
13
13
|
list(paginationParams: any, locale: any): Promise<{
|
14
|
-
total:
|
14
|
+
total: number;
|
15
15
|
lastPage: number;
|
16
16
|
page: number;
|
17
17
|
pageSize: number;
|
18
18
|
prev: number;
|
19
19
|
next: number;
|
20
|
-
data: any;
|
20
|
+
data: any[];
|
21
21
|
}>;
|
22
22
|
listRoles(menuId: number, paginationParams: any, locale: any): Promise<{
|
23
|
-
total:
|
23
|
+
total: number;
|
24
24
|
lastPage: number;
|
25
25
|
page: number;
|
26
26
|
pageSize: number;
|
27
27
|
prev: number;
|
28
28
|
next: number;
|
29
|
-
data: any;
|
29
|
+
data: any[];
|
30
30
|
}>;
|
31
31
|
listScreens(menuId: number, paginationParams: any, locale: any): Promise<{
|
32
|
-
total:
|
32
|
+
total: number;
|
33
33
|
lastPage: number;
|
34
34
|
page: number;
|
35
35
|
pageSize: number;
|
36
36
|
prev: number;
|
37
37
|
next: number;
|
38
|
-
data: any;
|
38
|
+
data: any[];
|
39
39
|
}>;
|
40
40
|
updateRoles(menuId: number, data: UpdateIdsDTO): Promise<any>;
|
41
41
|
updateScreens(menuId: number, data: UpdateIdsDTO): Promise<any>;
|
@@ -12,33 +12,33 @@ export declare class MenuService {
|
|
12
12
|
updateScreens(menuId: number, data: UpdateIdsDTO): Promise<any>;
|
13
13
|
updateRoles(menuId: number, data: UpdateIdsDTO): Promise<any>;
|
14
14
|
listScreens(locale: string, menuId: number, paginationParams: PaginationDTO): Promise<{
|
15
|
-
total:
|
15
|
+
total: number;
|
16
16
|
lastPage: number;
|
17
17
|
page: number;
|
18
18
|
pageSize: number;
|
19
19
|
prev: number;
|
20
20
|
next: number;
|
21
|
-
data: any;
|
21
|
+
data: any[];
|
22
22
|
}>;
|
23
23
|
listRoles(locale: string, menuId: number, paginationParams: PaginationDTO): Promise<{
|
24
|
-
total:
|
24
|
+
total: number;
|
25
25
|
lastPage: number;
|
26
26
|
page: number;
|
27
27
|
pageSize: number;
|
28
28
|
prev: number;
|
29
29
|
next: number;
|
30
|
-
data: any;
|
30
|
+
data: any[];
|
31
31
|
}>;
|
32
32
|
getMenus(locale: string, userId: number, menuId?: number): Promise<any[]>;
|
33
33
|
getSystemMenu(locale: string, userId: number): Promise<any[]>;
|
34
34
|
list(locale: string, paginationParams: PaginationDTO): Promise<{
|
35
|
-
total:
|
35
|
+
total: number;
|
36
36
|
lastPage: number;
|
37
37
|
page: number;
|
38
38
|
pageSize: number;
|
39
39
|
prev: number;
|
40
40
|
next: number;
|
41
|
-
data: any;
|
41
|
+
data: any[];
|
42
42
|
}>;
|
43
43
|
get(menuId: number): Promise<any>;
|
44
44
|
create({ slug, url, icon, order, menuId }: CreateDTO): Promise<any>;
|
@@ -7,49 +7,49 @@ export declare class RoleController {
|
|
7
7
|
private readonly roleService;
|
8
8
|
constructor(roleService: RoleService);
|
9
9
|
list(paginationParams: any, locale: any): Promise<{
|
10
|
-
total:
|
10
|
+
total: number;
|
11
11
|
lastPage: number;
|
12
12
|
page: number;
|
13
13
|
pageSize: number;
|
14
14
|
prev: number;
|
15
15
|
next: number;
|
16
|
-
data: any;
|
16
|
+
data: any[];
|
17
17
|
}>;
|
18
18
|
listUsers(paginationParams: any, roleId: number): Promise<{
|
19
|
-
total:
|
19
|
+
total: number;
|
20
20
|
lastPage: number;
|
21
21
|
page: number;
|
22
22
|
pageSize: number;
|
23
23
|
prev: number;
|
24
24
|
next: number;
|
25
|
-
data: any;
|
25
|
+
data: any[];
|
26
26
|
}>;
|
27
27
|
listMenus(paginationParams: any, roleId: number, locale: any): Promise<{
|
28
|
-
total:
|
28
|
+
total: number;
|
29
29
|
lastPage: number;
|
30
30
|
page: number;
|
31
31
|
pageSize: number;
|
32
32
|
prev: number;
|
33
33
|
next: number;
|
34
|
-
data: any;
|
34
|
+
data: any[];
|
35
35
|
}>;
|
36
36
|
listRoutes(paginationParams: any, roleId: number): Promise<{
|
37
|
-
total:
|
37
|
+
total: number;
|
38
38
|
lastPage: number;
|
39
39
|
page: number;
|
40
40
|
pageSize: number;
|
41
41
|
prev: number;
|
42
42
|
next: number;
|
43
|
-
data: any;
|
43
|
+
data: any[];
|
44
44
|
}>;
|
45
45
|
listScreens(paginationParams: any, roleId: number, locale: any): Promise<{
|
46
|
-
total:
|
46
|
+
total: number;
|
47
47
|
lastPage: number;
|
48
48
|
page: number;
|
49
49
|
pageSize: number;
|
50
50
|
prev: number;
|
51
51
|
next: number;
|
52
|
-
data: any;
|
52
|
+
data: any[];
|
53
53
|
}>;
|
54
54
|
updateUsers(roleId: number, data: UpdateIdsDTO): Promise<any>;
|
55
55
|
updateMenus(roleId: number, data: UpdateIdsDTO): Promise<any>;
|
@@ -15,49 +15,49 @@ export declare class RoleService {
|
|
15
15
|
updateRoutes(roleId: number, data: UpdateIdsDTO): Promise<any>;
|
16
16
|
updateMenus(roleId: number, data: UpdateIdsDTO): Promise<any>;
|
17
17
|
listUsers(roleId: number, paginationParams: PaginationDTO): Promise<{
|
18
|
-
total:
|
18
|
+
total: number;
|
19
19
|
lastPage: number;
|
20
20
|
page: number;
|
21
21
|
pageSize: number;
|
22
22
|
prev: number;
|
23
23
|
next: number;
|
24
|
-
data: any;
|
24
|
+
data: any[];
|
25
25
|
}>;
|
26
26
|
listMenus(locale: string, roleId: number, paginationParams: PaginationDTO): Promise<{
|
27
|
-
total:
|
27
|
+
total: number;
|
28
28
|
lastPage: number;
|
29
29
|
page: number;
|
30
30
|
pageSize: number;
|
31
31
|
prev: number;
|
32
32
|
next: number;
|
33
|
-
data: any;
|
33
|
+
data: any[];
|
34
34
|
}>;
|
35
35
|
listRoutes(roleId: number, paginationParams: PaginationDTO): Promise<{
|
36
|
-
total:
|
36
|
+
total: number;
|
37
37
|
lastPage: number;
|
38
38
|
page: number;
|
39
39
|
pageSize: number;
|
40
40
|
prev: number;
|
41
41
|
next: number;
|
42
|
-
data: any;
|
42
|
+
data: any[];
|
43
43
|
}>;
|
44
44
|
listScreens(locale: string, roleId: number, paginationParams: PaginationDTO): Promise<{
|
45
|
-
total:
|
45
|
+
total: number;
|
46
46
|
lastPage: number;
|
47
47
|
page: number;
|
48
48
|
pageSize: number;
|
49
49
|
prev: number;
|
50
50
|
next: number;
|
51
|
-
data: any;
|
51
|
+
data: any[];
|
52
52
|
}>;
|
53
53
|
list(locale: string, paginationParams: PaginationDTO): Promise<{
|
54
|
-
total:
|
54
|
+
total: number;
|
55
55
|
lastPage: number;
|
56
56
|
page: number;
|
57
57
|
pageSize: number;
|
58
58
|
prev: number;
|
59
59
|
next: number;
|
60
|
-
data: any;
|
60
|
+
data: any[];
|
61
61
|
}>;
|
62
62
|
get(locale: string, roleId: number): Promise<any>;
|
63
63
|
create({ slug }: CreateDTO): Promise<any>;
|
@@ -8,36 +8,36 @@ export declare class RouteController {
|
|
8
8
|
private readonly routeService;
|
9
9
|
constructor(routeService: RouteService);
|
10
10
|
list(paginationParams: any): Promise<{
|
11
|
-
total:
|
11
|
+
total: number;
|
12
12
|
lastPage: number;
|
13
13
|
page: number;
|
14
14
|
pageSize: number;
|
15
15
|
prev: number;
|
16
16
|
next: number;
|
17
|
-
data: any;
|
17
|
+
data: any[];
|
18
18
|
}>;
|
19
19
|
get(routeId: number): Promise<any>;
|
20
20
|
create({ url, method }: CreateDTO): Promise<any>;
|
21
21
|
update(routeId: number, data: UpdateDTO): Promise<any>;
|
22
22
|
delete(data: DeleteDTO): Promise<any>;
|
23
23
|
listRoles(routeId: number, paginationParams: PaginationDTO, locale: any): Promise<{
|
24
|
-
total:
|
24
|
+
total: number;
|
25
25
|
lastPage: number;
|
26
26
|
page: number;
|
27
27
|
pageSize: number;
|
28
28
|
prev: number;
|
29
29
|
next: number;
|
30
|
-
data: any;
|
30
|
+
data: any[];
|
31
31
|
}>;
|
32
32
|
updateRoles(routeId: number, data: UpdateIdsDTO): Promise<any>;
|
33
33
|
listScreens(routeId: number, paginationParams: PaginationDTO, locale: any): Promise<{
|
34
|
-
total:
|
34
|
+
total: number;
|
35
35
|
lastPage: number;
|
36
36
|
page: number;
|
37
37
|
pageSize: number;
|
38
38
|
prev: number;
|
39
39
|
next: number;
|
40
|
-
data: any;
|
40
|
+
data: any[];
|
41
41
|
}>;
|
42
42
|
updateScreens(routeId: number, data: UpdateIdsDTO): Promise<any>;
|
43
43
|
}
|
@@ -9,13 +9,13 @@ export declare class RouteService {
|
|
9
9
|
private readonly paginationService;
|
10
10
|
constructor(prismaService: PrismaService, paginationService: PaginationService);
|
11
11
|
list(paginationParams: PaginationDTO): Promise<{
|
12
|
-
total:
|
12
|
+
total: number;
|
13
13
|
lastPage: number;
|
14
14
|
page: number;
|
15
15
|
pageSize: number;
|
16
16
|
prev: number;
|
17
17
|
next: number;
|
18
|
-
data: any;
|
18
|
+
data: any[];
|
19
19
|
}>;
|
20
20
|
get(routeId: number): Promise<any>;
|
21
21
|
create({ url, method }: CreateDTO): Promise<any>;
|
@@ -25,23 +25,23 @@ export declare class RouteService {
|
|
25
25
|
}): Promise<any>;
|
26
26
|
delete({ ids }: DeleteDTO): Promise<any>;
|
27
27
|
listRoles(locale: string, routeId: number, paginationParams: PaginationDTO): Promise<{
|
28
|
-
total:
|
28
|
+
total: number;
|
29
29
|
lastPage: number;
|
30
30
|
page: number;
|
31
31
|
pageSize: number;
|
32
32
|
prev: number;
|
33
33
|
next: number;
|
34
|
-
data: any;
|
34
|
+
data: any[];
|
35
35
|
}>;
|
36
36
|
updateRoles(routeId: number, data: UpdateIdsDTO): Promise<any>;
|
37
37
|
listScreens(locale: string, routeId: number, paginationParams: PaginationDTO): Promise<{
|
38
|
-
total:
|
38
|
+
total: number;
|
39
39
|
lastPage: number;
|
40
40
|
page: number;
|
41
41
|
pageSize: number;
|
42
42
|
prev: number;
|
43
43
|
next: number;
|
44
|
-
data: any;
|
44
|
+
data: any[];
|
45
45
|
}>;
|
46
46
|
updateScreens(routeId: number, data: UpdateIdsDTO): Promise<any>;
|
47
47
|
}
|
@@ -7,31 +7,31 @@ export declare class ScreenController {
|
|
7
7
|
private readonly screenService;
|
8
8
|
constructor(screenService: ScreenService);
|
9
9
|
list(paginationParams: any, locale: any): Promise<{
|
10
|
-
total:
|
10
|
+
total: number;
|
11
11
|
lastPage: number;
|
12
12
|
page: number;
|
13
13
|
pageSize: number;
|
14
14
|
prev: number;
|
15
15
|
next: number;
|
16
|
-
data: any;
|
16
|
+
data: any[];
|
17
17
|
}>;
|
18
18
|
listRoles(screenId: number, paginationParams: any, locale: any): Promise<{
|
19
|
-
total:
|
19
|
+
total: number;
|
20
20
|
lastPage: number;
|
21
21
|
page: number;
|
22
22
|
pageSize: number;
|
23
23
|
prev: number;
|
24
24
|
next: number;
|
25
|
-
data: any;
|
25
|
+
data: any[];
|
26
26
|
}>;
|
27
27
|
listRoutes(screenId: number, paginationParams: any): Promise<{
|
28
|
-
total:
|
28
|
+
total: number;
|
29
29
|
lastPage: number;
|
30
30
|
page: number;
|
31
31
|
pageSize: number;
|
32
32
|
prev: number;
|
33
33
|
next: number;
|
34
|
-
data: any;
|
34
|
+
data: any[];
|
35
35
|
}>;
|
36
36
|
updateRoles(screenId: number, data: UpdateIdsDTO): Promise<any>;
|
37
37
|
updateRoutes(screenId: number, data: UpdateIdsDTO): Promise<any>;
|
@@ -11,31 +11,31 @@ export declare class ScreenService {
|
|
11
11
|
updateRoles(screenId: number, data: UpdateIdsDTO): Promise<any>;
|
12
12
|
updateRoutes(screenId: number, { ids }: UpdateIdsDTO): Promise<any>;
|
13
13
|
listRoutes(screenId: number, paginationParams: PaginationDTO): Promise<{
|
14
|
-
total:
|
14
|
+
total: number;
|
15
15
|
lastPage: number;
|
16
16
|
page: number;
|
17
17
|
pageSize: number;
|
18
18
|
prev: number;
|
19
19
|
next: number;
|
20
|
-
data: any;
|
20
|
+
data: any[];
|
21
21
|
}>;
|
22
22
|
listRoles(locale: string, screenId: number, paginationParams: PaginationDTO): Promise<{
|
23
|
-
total:
|
23
|
+
total: number;
|
24
24
|
lastPage: number;
|
25
25
|
page: number;
|
26
26
|
pageSize: number;
|
27
27
|
prev: number;
|
28
28
|
next: number;
|
29
|
-
data: any;
|
29
|
+
data: any[];
|
30
30
|
}>;
|
31
31
|
list(locale: string, paginationParams: PaginationDTO): Promise<{
|
32
|
-
total:
|
32
|
+
total: number;
|
33
33
|
lastPage: number;
|
34
34
|
page: number;
|
35
35
|
pageSize: number;
|
36
36
|
prev: number;
|
37
37
|
next: number;
|
38
|
-
data: any;
|
38
|
+
data: any[];
|
39
39
|
}>;
|
40
40
|
get(screenId: number): Promise<any>;
|
41
41
|
create({ slug, icon }: CreateDTO): Promise<any>;
|
@@ -7,22 +7,22 @@ export declare class UserController {
|
|
7
7
|
private readonly userService;
|
8
8
|
constructor(userService: UserService);
|
9
9
|
list(paginationParams: any): Promise<{
|
10
|
-
total:
|
10
|
+
total: number;
|
11
11
|
lastPage: number;
|
12
12
|
page: number;
|
13
13
|
pageSize: number;
|
14
14
|
prev: number;
|
15
15
|
next: number;
|
16
|
-
data: any;
|
16
|
+
data: any[];
|
17
17
|
}>;
|
18
18
|
listRoles(userId: number, paginationParams: any): Promise<{
|
19
|
-
total:
|
19
|
+
total: number;
|
20
20
|
lastPage: number;
|
21
21
|
page: number;
|
22
22
|
pageSize: number;
|
23
23
|
prev: number;
|
24
24
|
next: number;
|
25
|
-
data: any;
|
25
|
+
data: any[];
|
26
26
|
}>;
|
27
27
|
updateRoles(userId: number, data: UpdateIdsDTO): Promise<any>;
|
28
28
|
get(userId: number): Promise<any>;
|
@@ -9,23 +9,23 @@ export declare class UserService {
|
|
9
9
|
private readonly paginationService;
|
10
10
|
constructor(prismaService: PrismaService, paginationService: PaginationService);
|
11
11
|
listRoles(userId: number, paginationParams: PaginationDTO): Promise<{
|
12
|
-
total:
|
12
|
+
total: number;
|
13
13
|
lastPage: number;
|
14
14
|
page: number;
|
15
15
|
pageSize: number;
|
16
16
|
prev: number;
|
17
17
|
next: number;
|
18
|
-
data: any;
|
18
|
+
data: any[];
|
19
19
|
}>;
|
20
20
|
updateRoles(userId: number, { ids }: UpdateIdsDTO): Promise<any>;
|
21
21
|
list(paginationParams: PaginationDTO): Promise<{
|
22
|
-
total:
|
22
|
+
total: number;
|
23
23
|
lastPage: number;
|
24
24
|
page: number;
|
25
25
|
pageSize: number;
|
26
26
|
prev: number;
|
27
27
|
next: number;
|
28
|
-
data: any;
|
28
|
+
data: any[];
|
29
29
|
}>;
|
30
30
|
get(userId: number): Promise<any>;
|
31
31
|
hashPassword(password: string): Promise<string>;
|
package/package.json
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
{
|
2
|
-
"name": "@hedhog/admin",
|
3
|
-
"version": "0.7.
|
4
|
-
"private": false,
|
5
|
-
"main": "dist/index.js",
|
6
|
-
"scripts": {
|
7
|
-
"clean": "rimraf ./dist",
|
8
|
-
"prebuild": "npm run clean",
|
9
|
-
"build": "tsc --project tsconfig.production.json && npm version patch",
|
10
|
-
"prod": "npm run build && npm publish --access public"
|
11
|
-
},
|
12
|
-
"file": [
|
13
|
-
"dist/**/*",
|
14
|
-
"src/entities/**/*.ts",
|
15
|
-
"src/migrations/**/*.ts",
|
16
|
-
"src/**/*.ejs",
|
17
|
-
"hedhog.yaml"
|
18
|
-
],
|
19
|
-
"keywords": [],
|
20
|
-
"author": "",
|
21
|
-
"license": "MIT",
|
22
|
-
"description": "",
|
23
|
-
"devDependencies": {
|
24
|
-
"@hedhog/locale": "^0.
|
25
|
-
"@hedhog/mail": "^0.
|
26
|
-
"@hedhog/pagination": "^0.
|
27
|
-
"@hedhog/prisma": "^0.
|
28
|
-
"@hedhog/setting": "^0.
|
29
|
-
"@hedhog/utils": "^0.0.27",
|
30
|
-
"@nestjs/mapped-types": "^2.0.5",
|
31
|
-
"ts-node": "^10.9.1",
|
32
|
-
"typescript": "^5.1.3"
|
33
|
-
},
|
34
|
-
"peerDependencies": {
|
35
|
-
"@hedhog/locale": "latest",
|
36
|
-
"@hedhog/mail": "latest",
|
37
|
-
"@hedhog/pagination": "latest",
|
38
|
-
"@hedhog/prisma": "latest",
|
39
|
-
"@hedhog/setting": "latest",
|
40
|
-
"@hedhog/utils": "latest",
|
41
|
-
"@nestjs/jwt": "latest"
|
42
|
-
}
|
43
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@hedhog/admin",
|
3
|
+
"version": "0.7.5",
|
4
|
+
"private": false,
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"clean": "rimraf ./dist",
|
8
|
+
"prebuild": "npm run clean",
|
9
|
+
"build": "tsc --project tsconfig.production.json && npm version patch",
|
10
|
+
"prod": "npm run build && npm publish --access public"
|
11
|
+
},
|
12
|
+
"file": [
|
13
|
+
"dist/**/*",
|
14
|
+
"src/entities/**/*.ts",
|
15
|
+
"src/migrations/**/*.ts",
|
16
|
+
"src/**/*.ejs",
|
17
|
+
"hedhog.yaml"
|
18
|
+
],
|
19
|
+
"keywords": [],
|
20
|
+
"author": "",
|
21
|
+
"license": "MIT",
|
22
|
+
"description": "",
|
23
|
+
"devDependencies": {
|
24
|
+
"@hedhog/locale": "^0.7.6",
|
25
|
+
"@hedhog/mail": "^0.7.1",
|
26
|
+
"@hedhog/pagination": "^0.7.1",
|
27
|
+
"@hedhog/prisma": "^0.7.3",
|
28
|
+
"@hedhog/setting": "^0.7.4",
|
29
|
+
"@hedhog/utils": "^0.0.27",
|
30
|
+
"@nestjs/mapped-types": "^2.0.5",
|
31
|
+
"ts-node": "^10.9.1",
|
32
|
+
"typescript": "^5.1.3"
|
33
|
+
},
|
34
|
+
"peerDependencies": {
|
35
|
+
"@hedhog/locale": "latest",
|
36
|
+
"@hedhog/mail": "latest",
|
37
|
+
"@hedhog/pagination": "latest",
|
38
|
+
"@hedhog/prisma": "latest",
|
39
|
+
"@hedhog/setting": "latest",
|
40
|
+
"@hedhog/utils": "latest",
|
41
|
+
"@nestjs/jwt": "latest"
|
42
|
+
}
|
43
|
+
}
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
import { Role, Public, User } from '@hedhog/core';
|
10
10
|
import { AuthService } from './auth.service';
|
11
11
|
import { ForgetDTO } from './dto/forget.dto';
|
12
|
+
import { ResetDTO } from './dto/reset.dto';
|
12
13
|
import { LoginDTO } from './dto/login.dto';
|
13
14
|
import { OtpDTO } from './dto/otp.dto';
|
14
15
|
import { User as UserType } from './types/user.type';
|
@@ -18,7 +19,7 @@ export class AuthController {
|
|
18
19
|
constructor(
|
19
20
|
@Inject(forwardRef(() => AuthService))
|
20
21
|
private readonly service: AuthService,
|
21
|
-
) {}
|
22
|
+
) { }
|
22
23
|
|
23
24
|
@Role()
|
24
25
|
@Get('verify')
|
@@ -40,7 +41,32 @@ export class AuthController {
|
|
40
41
|
|
41
42
|
@Public()
|
42
43
|
@Post('forget')
|
43
|
-
async forget(@Body() {
|
44
|
-
|
44
|
+
async forget(@Body() {
|
45
|
+
email,
|
46
|
+
subject,
|
47
|
+
body,
|
48
|
+
}: ForgetDTO & {
|
49
|
+
subject: string;
|
50
|
+
body: string;
|
51
|
+
}) {
|
52
|
+
return this.service.forget({
|
53
|
+
email,
|
54
|
+
subject,
|
55
|
+
body,
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
@Public()
|
60
|
+
@Post('reset')
|
61
|
+
async reset(@Body() {
|
62
|
+
newPassword,
|
63
|
+
confirmNewPassword,
|
64
|
+
code,
|
65
|
+
}: ResetDTO) {
|
66
|
+
return this.service.resetPassword({
|
67
|
+
newPassword,
|
68
|
+
confirmNewPassword,
|
69
|
+
code,
|
70
|
+
});
|
45
71
|
}
|
46
72
|
}
|
package/src/auth/auth.service.ts
CHANGED
@@ -5,13 +5,15 @@ import {
|
|
5
5
|
Inject,
|
6
6
|
Injectable,
|
7
7
|
NotFoundException,
|
8
|
+
BadRequestException,
|
8
9
|
} from '@nestjs/common';
|
9
10
|
import { JwtService } from '@nestjs/jwt';
|
10
|
-
import { compare } from 'bcrypt';
|
11
|
+
import { compare, genSalt, hash } from 'bcrypt';
|
11
12
|
import { ForgetDTO } from './dto/forget.dto';
|
12
13
|
import { LoginDTO } from './dto/login.dto';
|
13
14
|
import { OtpDTO } from './dto/otp.dto';
|
14
15
|
import { MultifactorType } from './enums/multifactor-type.enum';
|
16
|
+
import { User } from 'hcode-core';
|
15
17
|
|
16
18
|
@Injectable()
|
17
19
|
export class AuthService {
|
@@ -22,7 +24,7 @@ export class AuthService {
|
|
22
24
|
private readonly jwt: JwtService,
|
23
25
|
@Inject(forwardRef(() => MailService))
|
24
26
|
private readonly mail: MailService,
|
25
|
-
) {}
|
27
|
+
) { }
|
26
28
|
|
27
29
|
async verifyToken(token: string) {
|
28
30
|
return this.jwt.verifyAsync(token, {
|
@@ -105,7 +107,14 @@ export class AuthService {
|
|
105
107
|
};
|
106
108
|
}
|
107
109
|
|
108
|
-
async forget({
|
110
|
+
async forget({
|
111
|
+
email,
|
112
|
+
subject,
|
113
|
+
body,
|
114
|
+
}: ForgetDTO & {
|
115
|
+
subject?: string;
|
116
|
+
body?: string;
|
117
|
+
}) {
|
109
118
|
const user = await this.prisma.user.findFirst({
|
110
119
|
where: {
|
111
120
|
email,
|
@@ -119,7 +128,11 @@ export class AuthService {
|
|
119
128
|
throw new NotFoundException('User not found');
|
120
129
|
}
|
121
130
|
|
122
|
-
const
|
131
|
+
const payload = {
|
132
|
+
...user,
|
133
|
+
};
|
134
|
+
|
135
|
+
const code = this.jwt.sign(payload);
|
123
136
|
|
124
137
|
await this.prisma.user.update({
|
125
138
|
where: {
|
@@ -132,13 +145,58 @@ export class AuthService {
|
|
132
145
|
|
133
146
|
await this.mail.send({
|
134
147
|
to: email,
|
135
|
-
subject: 'Reset password',
|
136
|
-
body: `Reset your password by clicking <a href="${process.env.FRONTEND_URL}/
|
148
|
+
subject: subject ?? 'Reset password',
|
149
|
+
body: body ?? `Reset your password by clicking <a href="${process.env.FRONTEND_URL}/password-recovery/${code}">here</a>`,
|
137
150
|
});
|
138
151
|
|
139
152
|
return true;
|
140
153
|
}
|
141
154
|
|
155
|
+
async resetPassword({
|
156
|
+
code,
|
157
|
+
newPassword,
|
158
|
+
confirmNewPassword,
|
159
|
+
}: {
|
160
|
+
code: string;
|
161
|
+
newPassword: string;
|
162
|
+
confirmNewPassword: string;
|
163
|
+
}) {
|
164
|
+
|
165
|
+
if (newPassword !== confirmNewPassword) {
|
166
|
+
throw new BadRequestException("Passwords don't match");
|
167
|
+
}
|
168
|
+
|
169
|
+
const { id } = this.jwt.decode(code) as User;
|
170
|
+
|
171
|
+
const user = await this.prisma.user.findFirst({
|
172
|
+
where: {
|
173
|
+
id,
|
174
|
+
code,
|
175
|
+
},
|
176
|
+
});
|
177
|
+
|
178
|
+
if (user) {
|
179
|
+
|
180
|
+
const salt = await genSalt();
|
181
|
+
const password = await hash(confirmNewPassword, salt);
|
182
|
+
|
183
|
+
await this.prisma.user.update({
|
184
|
+
where: {
|
185
|
+
id: user.id,
|
186
|
+
},
|
187
|
+
data: {
|
188
|
+
password,
|
189
|
+
},
|
190
|
+
});
|
191
|
+
|
192
|
+
return true;
|
193
|
+
|
194
|
+
}
|
195
|
+
|
196
|
+
return false;
|
197
|
+
|
198
|
+
}
|
199
|
+
|
142
200
|
async otp({ token, code }: OtpDTO) {
|
143
201
|
const data = this.jwt.decode(token);
|
144
202
|
|