@tomei/sso 0.10.0 → 0.11.3
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/__tests__/unit/components/login-user/login-user.spec.ts +2 -2
- package/dist/__tests__/unit/components/login-user/login-user.spec.js +2 -2
- package/dist/__tests__/unit/components/login-user/login-user.spec.js.map +1 -1
- package/dist/src/components/login-user/login-user.js +10 -9
- package/dist/src/components/login-user/login-user.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/login-user/login-user.ts +11 -9
package/package.json
CHANGED
@@ -101,6 +101,10 @@ export class LoginUser extends LoginUserBase {
|
|
101
101
|
],
|
102
102
|
});
|
103
103
|
|
104
|
+
if (!user) {
|
105
|
+
throw new Error('Invalid credentials.');
|
106
|
+
}
|
107
|
+
|
104
108
|
if (user) {
|
105
109
|
const userInfo: IUserInfo = {
|
106
110
|
ObjectId: user.id.toString(),
|
@@ -221,15 +225,13 @@ export class LoginUser extends LoginUserBase {
|
|
221
225
|
|
222
226
|
// record new login history
|
223
227
|
await LoginUser._LoginHistoryRepository.create({
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
createdAt: new Date(),
|
229
|
-
},
|
228
|
+
UserId: this.ObjectId,
|
229
|
+
SystemId: system.id,
|
230
|
+
OriginIp: ipAddress,
|
231
|
+
CreatedAt: new Date(),
|
230
232
|
});
|
231
233
|
|
232
|
-
return sessionId
|
234
|
+
return `${this.ObjectId}:${sessionId}`;
|
233
235
|
} catch (error) {
|
234
236
|
throw error;
|
235
237
|
}
|
@@ -263,8 +265,8 @@ export class LoginUser extends LoginUserBase {
|
|
263
265
|
try {
|
264
266
|
const userLogins = await LoginUser._LoginHistoryRepository.findAll({
|
265
267
|
where: {
|
266
|
-
|
267
|
-
|
268
|
+
UserId: userId,
|
269
|
+
SystemId: systemId,
|
268
270
|
},
|
269
271
|
});
|
270
272
|
|