@solidxai/core 0.1.6-beta.3 → 0.1.6-beta.6
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/seeders/seed-data/solid-core-metadata.json +73 -3
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +44 -21
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/queues/database-subscriber.service.d.ts +4 -2
- package/dist/services/queues/database-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/database-subscriber.service.js +9 -1
- package/dist/services/queues/database-subscriber.service.js.map +1 -1
- package/dist/services/queues/publisher-factory.service.d.ts.map +1 -1
- package/dist/services/queues/publisher-factory.service.js +4 -6
- package/dist/services/queues/publisher-factory.service.js.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts +4 -2
- package/dist/services/queues/rabbitmq-subscriber.service.d.ts.map +1 -1
- package/dist/services/queues/rabbitmq-subscriber.service.js +9 -1
- package/dist/services/queues/rabbitmq-subscriber.service.js.map +1 -1
- package/package.json +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +73 -3
- package/src/services/authentication.service.ts +46 -24
- package/src/services/queues/database-subscriber.service.ts +12 -1
- package/src/services/queues/publisher-factory.service.ts +8 -6
- package/src/services/queues/rabbitmq-subscriber.service.ts +12 -1
|
@@ -5721,7 +5721,7 @@
|
|
|
5721
5721
|
"modelUserKey": "listOfValues"
|
|
5722
5722
|
},
|
|
5723
5723
|
{
|
|
5724
|
-
"displayName": "Import Transactions
|
|
5724
|
+
"displayName": "Import Transactions",
|
|
5725
5725
|
"name": "importTransaction-list-action",
|
|
5726
5726
|
"type": "solid",
|
|
5727
5727
|
"domain": "",
|
|
@@ -5734,7 +5734,7 @@
|
|
|
5734
5734
|
"modelUserKey": "importTransaction"
|
|
5735
5735
|
},
|
|
5736
5736
|
{
|
|
5737
|
-
"displayName": "User Activity History
|
|
5737
|
+
"displayName": "User Activity History",
|
|
5738
5738
|
"name": "userActivityHistory-list-action",
|
|
5739
5739
|
"type": "solid",
|
|
5740
5740
|
"domain": "",
|
|
@@ -5746,6 +5746,19 @@
|
|
|
5746
5746
|
"moduleUserKey": "solid-core",
|
|
5747
5747
|
"modelUserKey": "userActivityHistory"
|
|
5748
5748
|
},
|
|
5749
|
+
{
|
|
5750
|
+
"displayName": "User Activity History",
|
|
5751
|
+
"name": "userActivityHistory-tree-action",
|
|
5752
|
+
"type": "solid",
|
|
5753
|
+
"domain": "",
|
|
5754
|
+
"context": "",
|
|
5755
|
+
"customComponent": "",
|
|
5756
|
+
"customIsModal": true,
|
|
5757
|
+
"serverEndpoint": "",
|
|
5758
|
+
"viewUserKey": "userActivityHistory-tree-view",
|
|
5759
|
+
"moduleUserKey": "solid-core",
|
|
5760
|
+
"modelUserKey": "userActivityHistory"
|
|
5761
|
+
},
|
|
5749
5762
|
{
|
|
5750
5763
|
"displayName": "App Settings",
|
|
5751
5764
|
"name": "appSettings-action",
|
|
@@ -11157,7 +11170,64 @@
|
|
|
11157
11170
|
{
|
|
11158
11171
|
"type": "field",
|
|
11159
11172
|
"attrs": {
|
|
11160
|
-
"name": "
|
|
11173
|
+
"name": "createdAt",
|
|
11174
|
+
"sortable": true,
|
|
11175
|
+
"filterable": true
|
|
11176
|
+
}
|
|
11177
|
+
}
|
|
11178
|
+
]
|
|
11179
|
+
}
|
|
11180
|
+
},
|
|
11181
|
+
{
|
|
11182
|
+
"name": "userActivityHistory-tree-view",
|
|
11183
|
+
"displayName": "User Activity History",
|
|
11184
|
+
"type": "tree",
|
|
11185
|
+
"context": "{}",
|
|
11186
|
+
"moduleUserKey": "solid-core",
|
|
11187
|
+
"modelUserKey": "userActivityHistory",
|
|
11188
|
+
"layout": {
|
|
11189
|
+
"type": "tree",
|
|
11190
|
+
"attrs": {
|
|
11191
|
+
"pagination": true,
|
|
11192
|
+
"pageSizeOptions": [
|
|
11193
|
+
10,
|
|
11194
|
+
25,
|
|
11195
|
+
50
|
|
11196
|
+
],
|
|
11197
|
+
"enableGlobalSearch": true,
|
|
11198
|
+
"create": true,
|
|
11199
|
+
"edit": true,
|
|
11200
|
+
"delete": true
|
|
11201
|
+
},
|
|
11202
|
+
"children": [
|
|
11203
|
+
{
|
|
11204
|
+
"type": "field",
|
|
11205
|
+
"attrs": {
|
|
11206
|
+
"name": "id",
|
|
11207
|
+
"sortable": true,
|
|
11208
|
+
"filterable": true
|
|
11209
|
+
}
|
|
11210
|
+
},
|
|
11211
|
+
{
|
|
11212
|
+
"type": "field",
|
|
11213
|
+
"attrs": {
|
|
11214
|
+
"name": "user",
|
|
11215
|
+
"sortable": true,
|
|
11216
|
+
"filterable": true
|
|
11217
|
+
}
|
|
11218
|
+
},
|
|
11219
|
+
{
|
|
11220
|
+
"type": "field",
|
|
11221
|
+
"attrs": {
|
|
11222
|
+
"name": "event",
|
|
11223
|
+
"sortable": true,
|
|
11224
|
+
"filterable": true
|
|
11225
|
+
}
|
|
11226
|
+
},
|
|
11227
|
+
{
|
|
11228
|
+
"type": "field",
|
|
11229
|
+
"attrs": {
|
|
11230
|
+
"name": "ipAddress",
|
|
11161
11231
|
"sortable": true,
|
|
11162
11232
|
"filterable": true
|
|
11163
11233
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.service.d.ts","sourceRoot":"","sources":["../../src/services/authentication.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAY5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMzC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAOjD,OAAO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AS,EAAE,YAAY;;;;;;;;;;IAgB9C,OAAO,CAAC,gBAAgB;YAmBV,gBAAgB;YAqBhB,cAAc;IAmB5B,OAAO,CAAC,qBAAqB;YAOf,6BAA6B;IA6CrC,eAAe,CAAC,gBAAgB,EAAE,gBAAgB;;;;;;;;;;;;IAoCxD,OAAO,CAAC,gBAAgB;YAaV,aAAa;YAwBb,uBAAuB;IAO/B,cAAc,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc;YAuDvE,2BAA2B;IAYnC,sBAAsB,CAAC,yBAAyB,EAAE,yBAAyB;;;;;;;;;;;YAkDnE,0BAA0B;IA4ClC,qBAAqB,CAAC,wBAAwB,EAAE,wBAAwB;;;;;;;YA8ChE,2BAA2B;IA4CnC,cAAc,CAAC,IAAI,EAAE,IAAI;;;;IAazB,mBAAmB,CAAC,IAAI,EAAE,IAAI;IAe9B,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,oBAAoB,CAAC,EAAE,MAAM;IAa9D,aAAa,CAAC,eAAe,EAAE,eAAe;;;;YAmDtC,SAAS;IAqBjB,uBAAuB,CAAC,IAAI,EAAE,IAAI;IAkBlC,iBAAiB,CAAC,UAAU,EAAE,MAAM;;;;;;;;;;;YAqC5B,iCAAiC;IAK/C,OAAO,CAAC,mBAAmB;YAOb,uBAAuB;YAMvB,mBAAmB;IAa3B,MAAM,CAAC,YAAY,EAAE,MAAM;;;IAuC3B,YAAY,CAAC,MAAM,EAAE,MAAM;IAS3B,EAAE,CAAC,UAAU,EAAE,cAAc;;;;;;;;;;CA8BtC"}
|
|
@@ -347,9 +347,6 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
347
347
|
}
|
|
348
348
|
async notifyUserOnOtpInitiateRegistration(user, registrationValidationSource) {
|
|
349
349
|
const companyLogo = await this.getCompanyLogo();
|
|
350
|
-
const dummyOtp = this.getDummyOtpForUser(user);
|
|
351
|
-
if (dummyOtp)
|
|
352
|
-
return;
|
|
353
350
|
if (registrationValidationSource === constants_1.PasswordlessLoginValidateWhatSources.EMAIL) {
|
|
354
351
|
const mailService = this.mailServiceFactory.getMailService();
|
|
355
352
|
mailService.sendEmailUsingTemplate(user.email, 'otp-on-register', {
|
|
@@ -443,13 +440,12 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
443
440
|
}
|
|
444
441
|
return true;
|
|
445
442
|
}
|
|
446
|
-
async otp(
|
|
443
|
+
async otp() {
|
|
447
444
|
const now = new Date();
|
|
448
445
|
const otpExpiry = this.settingService.getConfigValue('otpExpiry');
|
|
449
|
-
const dummyOtp = this.getDummyOtpForUser(user);
|
|
450
446
|
now.setMinutes(now.getMinutes() + otpExpiry);
|
|
451
447
|
return {
|
|
452
|
-
token:
|
|
448
|
+
token: (0, crypto_1.randomInt)(100000, 999999).toString(),
|
|
453
449
|
expiresAt: now,
|
|
454
450
|
};
|
|
455
451
|
}
|
|
@@ -527,8 +523,11 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
527
523
|
}
|
|
528
524
|
const type = this.resolveLoginType(signInDto);
|
|
529
525
|
const user = await this.findUserForLogin(type, signInDto.identifier);
|
|
530
|
-
|
|
531
|
-
|
|
526
|
+
const dummyOtp = this.getDummyOtpForUser(user);
|
|
527
|
+
if (!dummyOtp) {
|
|
528
|
+
await this.assignLoginOtp(user, type);
|
|
529
|
+
this.notifyUserOnOtpInititateLogin(user, type);
|
|
530
|
+
}
|
|
532
531
|
return this.buildLoginOtpResponse(user, type);
|
|
533
532
|
}
|
|
534
533
|
resolveLoginType(signInDto) {
|
|
@@ -563,16 +562,23 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
563
562
|
return user;
|
|
564
563
|
}
|
|
565
564
|
async assignLoginOtp(user, type) {
|
|
566
|
-
const { token, expiresAt } = await this.otp(
|
|
565
|
+
const { token, expiresAt } = await this.otp();
|
|
567
566
|
if (type === constants_1.PasswordlessLoginValidateWhatSources.EMAIL) {
|
|
568
567
|
user.emailVerificationTokenOnLogin = token;
|
|
569
568
|
user.emailVerificationTokenOnLoginExpiresAt = expiresAt;
|
|
569
|
+
await this.userRepository.update(user.id, {
|
|
570
|
+
emailVerificationTokenOnLogin: token,
|
|
571
|
+
emailVerificationTokenOnLoginExpiresAt: expiresAt,
|
|
572
|
+
});
|
|
570
573
|
}
|
|
571
574
|
else {
|
|
572
575
|
user.mobileVerificationTokenOnLogin = token;
|
|
573
576
|
user.mobileVerificationTokenOnLoginExpiresAt = expiresAt;
|
|
577
|
+
await this.userRepository.update(user.id, {
|
|
578
|
+
mobileVerificationTokenOnLogin: token,
|
|
579
|
+
mobileVerificationTokenOnLoginExpiresAt: expiresAt,
|
|
580
|
+
});
|
|
574
581
|
}
|
|
575
|
-
await this.userRepository.save(user);
|
|
576
582
|
}
|
|
577
583
|
buildLoginOtpResponse(user, type) {
|
|
578
584
|
const maskedIdentifier = type === constants_1.PasswordlessLoginValidateWhatSources.EMAIL
|
|
@@ -620,6 +626,13 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
620
626
|
}
|
|
621
627
|
const user = await this.findUserForLogin(type, identifier, { withRoles: true });
|
|
622
628
|
this.checkAccountBlocked(user);
|
|
629
|
+
const dummyOtp = this.getDummyOtpForUser(user);
|
|
630
|
+
if (dummyOtp) {
|
|
631
|
+
if (otp !== dummyOtp) {
|
|
632
|
+
throw new common_1.UnauthorizedException(error_messages_1.ERROR_MESSAGES.INVALID_OTP);
|
|
633
|
+
}
|
|
634
|
+
return this.buildLoginTokenResponse(user);
|
|
635
|
+
}
|
|
623
636
|
try {
|
|
624
637
|
this.validateLoginOtp(user, otp, type);
|
|
625
638
|
}
|
|
@@ -627,12 +640,9 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
627
640
|
await this.incrementFailedAttempts(user);
|
|
628
641
|
throw e;
|
|
629
642
|
}
|
|
630
|
-
|
|
631
|
-
if (!dummyOtp)
|
|
632
|
-
this.clearLoginOtp(user, type);
|
|
633
|
-
user.failedLoginAttempts = 0;
|
|
643
|
+
await this.clearLoginOtp(user, type);
|
|
634
644
|
await this.userActivityHistoryService.logEvent('login', user);
|
|
635
|
-
await this.
|
|
645
|
+
await this.resetFailedAttempts(user);
|
|
636
646
|
return this.buildLoginTokenResponse(user);
|
|
637
647
|
}
|
|
638
648
|
validateLoginOtp(user, otp, type) {
|
|
@@ -646,16 +656,28 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
646
656
|
throw new common_1.UnauthorizedException(error_messages_1.ERROR_MESSAGES.OTP_EXPIRED);
|
|
647
657
|
}
|
|
648
658
|
}
|
|
649
|
-
clearLoginOtp(user, type) {
|
|
659
|
+
async clearLoginOtp(user, type) {
|
|
650
660
|
if (type === constants_1.PasswordlessLoginValidateWhatSources.EMAIL) {
|
|
651
|
-
|
|
661
|
+
const verifiedAt = new Date();
|
|
662
|
+
user.emailVerifiedOnLoginAt = verifiedAt;
|
|
652
663
|
user.emailVerificationTokenOnLogin = null;
|
|
653
664
|
user.emailVerificationTokenOnLoginExpiresAt = null;
|
|
665
|
+
await this.userRepository.update(user.id, {
|
|
666
|
+
emailVerifiedOnLoginAt: verifiedAt,
|
|
667
|
+
emailVerificationTokenOnLogin: null,
|
|
668
|
+
emailVerificationTokenOnLoginExpiresAt: null,
|
|
669
|
+
});
|
|
654
670
|
}
|
|
655
671
|
else {
|
|
656
|
-
|
|
672
|
+
const verifiedAt = new Date();
|
|
673
|
+
user.mobileVerifiedOnLoginAt = verifiedAt;
|
|
657
674
|
user.mobileVerificationTokenOnLogin = null;
|
|
658
675
|
user.mobileVerificationTokenOnLoginExpiresAt = null;
|
|
676
|
+
await this.userRepository.update(user.id, {
|
|
677
|
+
mobileVerifiedOnLoginAt: verifiedAt,
|
|
678
|
+
mobileVerificationTokenOnLogin: null,
|
|
679
|
+
mobileVerificationTokenOnLoginExpiresAt: null,
|
|
680
|
+
});
|
|
659
681
|
}
|
|
660
682
|
}
|
|
661
683
|
async buildLoginTokenResponse(user) {
|
|
@@ -958,14 +980,15 @@ let AuthenticationService = AuthenticationService_1 = class AuthenticationServic
|
|
|
958
980
|
}
|
|
959
981
|
}
|
|
960
982
|
async incrementFailedAttempts(user) {
|
|
961
|
-
user.failedLoginAttempts
|
|
962
|
-
|
|
983
|
+
const nextFailedAttempts = (user.failedLoginAttempts ?? 0) + 1;
|
|
984
|
+
user.failedLoginAttempts = nextFailedAttempts;
|
|
985
|
+
await this.userRepository.update(user.id, { failedLoginAttempts: nextFailedAttempts });
|
|
963
986
|
}
|
|
964
987
|
async resetFailedAttempts(user) {
|
|
965
988
|
if (user.failedLoginAttempts === 0)
|
|
966
989
|
return;
|
|
967
990
|
user.failedLoginAttempts = 0;
|
|
968
|
-
await this.userRepository.
|
|
991
|
+
await this.userRepository.update(user.id, { failedLoginAttempts: 0 });
|
|
969
992
|
}
|
|
970
993
|
async logout(refreshToken) {
|
|
971
994
|
try {
|