rez_core 1.0.13 → 1.0.15
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/module/notification/controller/otp.controller.d.ts +2 -2
- package/dist/module/notification/controller/otp.controller.js +13 -8
- package/dist/module/notification/controller/otp.controller.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/notification/controller/otp.controller.ts +12 -3
|
@@ -4,11 +4,11 @@ export declare class OtpController {
|
|
|
4
4
|
otpExpiry: string;
|
|
5
5
|
otpLength: string;
|
|
6
6
|
constructor(otpService: OtpService);
|
|
7
|
-
generateOtp(
|
|
7
|
+
generateOtp(request: any): Promise<{
|
|
8
8
|
otp_id: string;
|
|
9
9
|
success: boolean;
|
|
10
10
|
}>;
|
|
11
|
-
verifyOtp(
|
|
11
|
+
verifyOtp(request: any): Promise<{
|
|
12
12
|
message: string;
|
|
13
13
|
success: boolean;
|
|
14
14
|
}>;
|
|
@@ -21,11 +21,18 @@ let OtpController = class OtpController {
|
|
|
21
21
|
this.otpExpiry = process.env.otp_expiry || '2';
|
|
22
22
|
this.otpLength = process.env.otp_length || '6';
|
|
23
23
|
}
|
|
24
|
-
async generateOtp(
|
|
24
|
+
async generateOtp(request) {
|
|
25
|
+
let identifier = request.identifier;
|
|
26
|
+
let service = request.service;
|
|
27
|
+
if (!identifier || !service) {
|
|
28
|
+
throw new common_1.BadRequestException('Missing identifier or service!');
|
|
29
|
+
}
|
|
25
30
|
let otp = await this.otpService.generate(identifier, service, parseInt(this.otpExpiry), parseInt(this.otpLength));
|
|
26
31
|
return { 'otp_id': otp.otp_id, 'success': true };
|
|
27
32
|
}
|
|
28
|
-
async verifyOtp(
|
|
33
|
+
async verifyOtp(request) {
|
|
34
|
+
let otp = request.otp;
|
|
35
|
+
let otpId = request.otp_id;
|
|
29
36
|
let verify = await this.otpService.verifyOtp(otp, otpId);
|
|
30
37
|
if (!verify) {
|
|
31
38
|
throw new common_1.BadRequestException('Invalid OTP!');
|
|
@@ -37,19 +44,17 @@ exports.OtpController = OtpController;
|
|
|
37
44
|
__decorate([
|
|
38
45
|
(0, common_1.Post)('generate'),
|
|
39
46
|
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
40
|
-
__param(0, (0, common_1.
|
|
41
|
-
__param(1, (0, common_1.Query)('service')),
|
|
47
|
+
__param(0, (0, common_1.Body)()),
|
|
42
48
|
__metadata("design:type", Function),
|
|
43
|
-
__metadata("design:paramtypes", [
|
|
49
|
+
__metadata("design:paramtypes", [Object]),
|
|
44
50
|
__metadata("design:returntype", Promise)
|
|
45
51
|
], OtpController.prototype, "generateOtp", null);
|
|
46
52
|
__decorate([
|
|
47
53
|
(0, common_1.Post)('verify'),
|
|
48
54
|
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
49
|
-
__param(0, (0, common_1.
|
|
50
|
-
__param(1, (0, common_1.Query)('otp_id')),
|
|
55
|
+
__param(0, (0, common_1.Body)()),
|
|
51
56
|
__metadata("design:type", Function),
|
|
52
|
-
__metadata("design:paramtypes", [
|
|
57
|
+
__metadata("design:paramtypes", [Object]),
|
|
53
58
|
__metadata("design:returntype", Promise)
|
|
54
59
|
], OtpController.prototype, "verifyOtp", null);
|
|
55
60
|
exports.OtpController = OtpController = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.controller.js","sourceRoot":"","sources":["../../../../src/module/notification/controller/otp.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"otp.controller.js","sourceRoot":"","sources":["../../../../src/module/notification/controller/otp.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0G;AAC1G,wDAAoD;AAG7C,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGxB,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAFnD,cAAS,GAAG,OAAO,CAAC,GAAG,CAA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