ecrs-auth-core 1.0.73 → 1.0.74
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/auth.controller.js
CHANGED
|
@@ -124,6 +124,11 @@ let AuthController = class AuthController {
|
|
|
124
124
|
getClientIp(request) {
|
|
125
125
|
// Check X-Forwarded-For header (most common with proxies)
|
|
126
126
|
const xForwardedFor = request.headers['x-forwarded-for'];
|
|
127
|
+
console.log('X-Forwarded-For header:', xForwardedFor);
|
|
128
|
+
console.log('Request IP:', request.ip);
|
|
129
|
+
console.log('Socket Remote Address:', request.socket.remoteAddress);
|
|
130
|
+
console.log('X-Real-IP header:', request.headers['x-real-ip']);
|
|
131
|
+
console.log('CF-Connecting-IP header:', request.headers['cf-connecting-ip']);
|
|
127
132
|
if (xForwardedFor) {
|
|
128
133
|
const ips = Array.isArray(xForwardedFor)
|
|
129
134
|
? xForwardedFor
|
package/dist/auth.service.d.ts
CHANGED
package/dist/auth.service.js
CHANGED
|
@@ -213,7 +213,7 @@ let AuthService = class AuthService {
|
|
|
213
213
|
let dispatchCenterId = null;
|
|
214
214
|
let departmentId = null;
|
|
215
215
|
let designationId = null;
|
|
216
|
-
if (this.employeeWorkProfileRepo) {
|
|
216
|
+
if (this.employeeWorkProfileRepo && user.referenceId != null) {
|
|
217
217
|
try {
|
|
218
218
|
const workProfile = await this.employeeWorkProfileRepo.findOne({
|
|
219
219
|
where: { employee_id: user.referenceId },
|
|
@@ -230,6 +230,25 @@ let AuthService = class AuthService {
|
|
|
230
230
|
// Continue with null values if fetch fails
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
+
// Fetch last login details
|
|
234
|
+
let lastLoginTime = null;
|
|
235
|
+
let lastLoginStatus = null;
|
|
236
|
+
let lastLoginIpAddress = null;
|
|
237
|
+
if (this.userLastLoginRepo) {
|
|
238
|
+
try {
|
|
239
|
+
const lastLogin = await this.userLastLoginRepo.findOne({
|
|
240
|
+
where: { user_id: user.id },
|
|
241
|
+
order: { login_time: 'DESC' },
|
|
242
|
+
});
|
|
243
|
+
if (lastLogin) {
|
|
244
|
+
lastLoginTime = lastLogin?.login_time || null;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
console.error('Error fetching last login details:', error);
|
|
249
|
+
// Continue with null values if fetch fails
|
|
250
|
+
}
|
|
251
|
+
}
|
|
233
252
|
const payload = {
|
|
234
253
|
id: user.id,
|
|
235
254
|
email: user.email,
|
|
@@ -249,6 +268,8 @@ let AuthService = class AuthService {
|
|
|
249
268
|
dispatchCenterId,
|
|
250
269
|
departmentId,
|
|
251
270
|
designationId,
|
|
271
|
+
lastLoginTime: lastLoginTime,
|
|
272
|
+
is_otp_verified: user.isOtpVerified || false,
|
|
252
273
|
};
|
|
253
274
|
return {
|
|
254
275
|
status: true,
|
|
@@ -272,6 +293,8 @@ let AuthService = class AuthService {
|
|
|
272
293
|
dispatchCenterId,
|
|
273
294
|
departmentId,
|
|
274
295
|
designationId,
|
|
296
|
+
lastLoginTime: lastLoginTime,
|
|
297
|
+
is_otp_verified: user.isOtpVerified || false,
|
|
275
298
|
profile_photo_url: `${this.uploadPhotoDir}`,
|
|
276
299
|
},
|
|
277
300
|
},
|