@tomei/sso 0.10.0 → 0.11.4
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/src/session/session.service.js +1 -2
- package/dist/src/session/session.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/login-user/login-user.ts +11 -10
- package/src/session/session.service.ts +1 -2
package/package.json
CHANGED
@@ -7,7 +7,6 @@ import { SystemAccessRepository } from '../system-access/system-access.repositor
|
|
7
7
|
import { LoginHistoryRepository } from '../login-history/login-history.repository';
|
8
8
|
import { UserUserGroupRepository } from '../user-user-group/user-user-group.repository';
|
9
9
|
import { PasswordHashService } from '../password-hash/password-hash.service';
|
10
|
-
import { SessionService } from '../../session/session.service';
|
11
10
|
import { UserGroupRepository } from '../user-group/user-group.repository';
|
12
11
|
import { SMTPMailer } from '@tomei/mailer';
|
13
12
|
import { ISystemLogin } from '../../../src/interfaces/system-login.interface';
|
@@ -101,6 +100,10 @@ export class LoginUser extends LoginUserBase {
|
|
101
100
|
],
|
102
101
|
});
|
103
102
|
|
103
|
+
if (!user) {
|
104
|
+
throw new Error('Invalid credentials.');
|
105
|
+
}
|
106
|
+
|
104
107
|
if (user) {
|
105
108
|
const userInfo: IUserInfo = {
|
106
109
|
ObjectId: user.id.toString(),
|
@@ -221,15 +224,13 @@ export class LoginUser extends LoginUserBase {
|
|
221
224
|
|
222
225
|
// record new login history
|
223
226
|
await LoginUser._LoginHistoryRepository.create({
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
createdAt: new Date(),
|
229
|
-
},
|
227
|
+
UserId: this.ObjectId,
|
228
|
+
SystemId: system.id,
|
229
|
+
OriginIp: ipAddress,
|
230
|
+
CreatedAt: new Date(),
|
230
231
|
});
|
231
232
|
|
232
|
-
return sessionId
|
233
|
+
return `${this.ObjectId}:${sessionId}`;
|
233
234
|
} catch (error) {
|
234
235
|
throw error;
|
235
236
|
}
|
@@ -263,8 +264,8 @@ export class LoginUser extends LoginUserBase {
|
|
263
264
|
try {
|
264
265
|
const userLogins = await LoginUser._LoginHistoryRepository.findAll({
|
265
266
|
where: {
|
266
|
-
|
267
|
-
|
267
|
+
UserId: userId,
|
268
|
+
SystemId: systemId,
|
268
269
|
},
|
269
270
|
});
|
270
271
|
|
@@ -45,9 +45,8 @@ export class SessionService implements ISessionService {
|
|
45
45
|
|
46
46
|
async refreshDuration(userid: string): Promise<void> {
|
47
47
|
try {
|
48
|
-
const key = `tomei-sid:${userid}`;
|
49
48
|
const userSession = await this.retrieveUserSession(userid);
|
50
|
-
await this.setUserSession(
|
49
|
+
await this.setUserSession(userid, userSession);
|
51
50
|
} catch (error) {
|
52
51
|
throw error;
|
53
52
|
}
|