@tomei/sso 0.28.3 → 0.28.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/package.json
CHANGED
|
@@ -296,6 +296,7 @@ export class LoginUser extends LoginUserBase {
|
|
|
296
296
|
model: Staff,
|
|
297
297
|
},
|
|
298
298
|
],
|
|
299
|
+
transaction: dbTransaction,
|
|
299
300
|
});
|
|
300
301
|
|
|
301
302
|
if (!user) {
|
|
@@ -368,9 +369,9 @@ export class LoginUser extends LoginUserBase {
|
|
|
368
369
|
const userAttr: IUserAttr = {
|
|
369
370
|
UserId: user.UserId,
|
|
370
371
|
UserName: user.UserName,
|
|
371
|
-
FullName: user.Staff.FullName,
|
|
372
|
-
IDNo: user.Staff.IdNo,
|
|
373
|
-
ContactNo: user.Staff.Mobile,
|
|
372
|
+
FullName: user.Staff.FullName || null,
|
|
373
|
+
IDNo: user.Staff.IdNo || null,
|
|
374
|
+
ContactNo: user.Staff.Mobile || null,
|
|
374
375
|
Email: user.Email,
|
|
375
376
|
Password: user.Password,
|
|
376
377
|
Status: user.Status,
|
|
@@ -388,7 +389,7 @@ export class LoginUser extends LoginUserBase {
|
|
|
388
389
|
CreatedAt: user.CreatedAt,
|
|
389
390
|
UpdatedById: user.UpdatedById,
|
|
390
391
|
UpdatedAt: user.UpdatedAt,
|
|
391
|
-
staffs: user.Staff,
|
|
392
|
+
staffs: user.Staff || null,
|
|
392
393
|
};
|
|
393
394
|
|
|
394
395
|
this.UserId = userAttr.UserId;
|
|
@@ -562,14 +563,18 @@ export class LoginUser extends LoginUserBase {
|
|
|
562
563
|
this._SessionService.setUserSession(this.ObjectId, userSession);
|
|
563
564
|
|
|
564
565
|
// record new login history
|
|
565
|
-
await LoginUser._LoginHistoryRepository.create(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
566
|
+
await LoginUser._LoginHistoryRepository.create(
|
|
567
|
+
{
|
|
568
|
+
UserId: this.UserId,
|
|
569
|
+
SystemCode: system.SystemCode,
|
|
570
|
+
OriginIp: ipAddress,
|
|
571
|
+
CreatedAt: new Date(),
|
|
572
|
+
LoginStatus: LoginStatusEnum.SUCCESS,
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
transaction: dbTransaction,
|
|
576
|
+
},
|
|
577
|
+
);
|
|
573
578
|
|
|
574
579
|
// Retrieve is2FAEnabledYN from sso-config with ComponentConfig.
|
|
575
580
|
const is2FAEnabledYN = ComponentConfig.getComponentConfigValue(
|
|
@@ -583,14 +588,20 @@ export class LoginUser extends LoginUserBase {
|
|
|
583
588
|
|
|
584
589
|
return `${this.UserId}:${sessionId}`;
|
|
585
590
|
} catch (error) {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
591
|
+
if (this.ObjectId) {
|
|
592
|
+
await LoginUser._LoginHistoryRepository.create(
|
|
593
|
+
{
|
|
594
|
+
UserId: this.UserId,
|
|
595
|
+
SystemCode: systemCode,
|
|
596
|
+
OriginIp: ipAddress,
|
|
597
|
+
LoginStatus: LoginStatusEnum.FAILURE,
|
|
598
|
+
CreatedAt: new Date(),
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
transaction: dbTransaction,
|
|
602
|
+
},
|
|
603
|
+
);
|
|
604
|
+
}
|
|
594
605
|
throw error;
|
|
595
606
|
}
|
|
596
607
|
}
|