@tomei/sso 0.28.4 → 0.28.5
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -369,9 +369,9 @@ export class LoginUser extends LoginUserBase {
|
|
369
369
|
const userAttr: IUserAttr = {
|
370
370
|
UserId: user.UserId,
|
371
371
|
UserName: user.UserName,
|
372
|
-
FullName: user.Staff.FullName,
|
373
|
-
IDNo: user.Staff.IdNo,
|
374
|
-
ContactNo: user.Staff.Mobile,
|
372
|
+
FullName: user.Staff.FullName || null,
|
373
|
+
IDNo: user.Staff.IdNo || null,
|
374
|
+
ContactNo: user.Staff.Mobile || null,
|
375
375
|
Email: user.Email,
|
376
376
|
Password: user.Password,
|
377
377
|
Status: user.Status,
|
@@ -389,7 +389,7 @@ export class LoginUser extends LoginUserBase {
|
|
389
389
|
CreatedAt: user.CreatedAt,
|
390
390
|
UpdatedById: user.UpdatedById,
|
391
391
|
UpdatedAt: user.UpdatedAt,
|
392
|
-
staffs: user.Staff,
|
392
|
+
staffs: user.Staff || null,
|
393
393
|
};
|
394
394
|
|
395
395
|
this.UserId = userAttr.UserId;
|
@@ -563,14 +563,18 @@ export class LoginUser extends LoginUserBase {
|
|
563
563
|
this._SessionService.setUserSession(this.ObjectId, userSession);
|
564
564
|
|
565
565
|
// record new login history
|
566
|
-
await LoginUser._LoginHistoryRepository.create(
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
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
|
+
);
|
574
578
|
|
575
579
|
// Retrieve is2FAEnabledYN from sso-config with ComponentConfig.
|
576
580
|
const is2FAEnabledYN = ComponentConfig.getComponentConfigValue(
|
@@ -585,14 +589,18 @@ export class LoginUser extends LoginUserBase {
|
|
585
589
|
return `${this.UserId}:${sessionId}`;
|
586
590
|
} catch (error) {
|
587
591
|
if (this.ObjectId) {
|
588
|
-
await LoginUser._LoginHistoryRepository.create(
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
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
|
+
);
|
596
604
|
}
|
597
605
|
throw error;
|
598
606
|
}
|