ecrs-auth-core 1.0.75 → 1.0.76

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.
@@ -34,8 +34,12 @@ let AuthController = class AuthController {
34
34
  console.log(`🔐 User validation result for ${body.email}: ${user ? 'Success' : 'Failed'}`);
35
35
  if (!user) {
36
36
  // Save failed login attempt to both tables
37
- await this.authService.saveLastLogin({ email: body.email }, clientIp, 'failed', 'Invalid credentials or IP not allowed', additionalData).catch(() => { }); // Ignore errors
38
- await this.authService.saveLoginDetailsJson({ email: body.email }, clientIp, 'failed', 'Invalid credentials or IP not allowed', additionalData).catch(() => { }); // Ignore errors
37
+ await this.authService.saveLastLogin({ email: body.email }, clientIp, 'failed', 'Invalid credentials or IP not allowed', additionalData).catch((err) => {
38
+ console.error('❌ Error saving failed login to tbl_user_last_login:', err.message);
39
+ }); // Log errors for debugging
40
+ await this.authService.saveLoginDetailsJson({ email: body.email }, clientIp, 'failed', 'Invalid credentials or IP not allowed', additionalData).catch((err) => {
41
+ console.error('❌ Error saving failed login to tbl_user_login_details:', err.message);
42
+ }); // Log errors for debugging
39
43
  throw new common_1.UnauthorizedException('Login failed: email or password not matched or IP not allowed');
40
44
  }
41
45
  const requestedModuleId = Number(body.moduleId);
@@ -56,12 +60,16 @@ let AuthController = class AuthController {
56
60
  await this.authService.saveLastLogin(user, clientIp, 'success', undefined, {
57
61
  ...additionalData,
58
62
  moduleId: requestedModuleId,
59
- }).catch(() => { }); // Ignore errors - don't block login
63
+ }).catch((err) => {
64
+ console.error('❌ Error saving successful login to tbl_user_last_login:', err.message);
65
+ }); // Log errors for debugging
60
66
  // Save to JSON-based login details table
61
67
  await this.authService.saveLoginDetailsJson(user, clientIp, 'success', undefined, {
62
68
  ...additionalData,
63
69
  moduleId: requestedModuleId,
64
- }).catch(() => { }); // Ignore errors - don't block login
70
+ }).catch((err) => {
71
+ console.error('❌ Error saving successful login to tbl_user_login_details:', err.message);
72
+ }); // Log errors for debugging
65
73
  return loginResponse;
66
74
  }
67
75
  /**
@@ -178,6 +178,7 @@ let AuthService = class AuthService {
178
178
  async saveLastLogin(user, clientIp, loginStatus = 'success', failureReason, additionalData) {
179
179
  if (!this.userLastLoginRepo) {
180
180
  // Last login tracking not configured
181
+ console.warn('⚠️ userLastLoginRepo not configured. Add loginDetailsRepo to AuthCoreModule repositories.');
181
182
  return;
182
183
  }
183
184
  try {
@@ -231,6 +232,7 @@ let AuthService = class AuthService {
231
232
  async saveLoginDetailsJson(user, clientIp, loginStatus = 'success', failureReason, additionalData) {
232
233
  if (!this.loginDetailsRepo) {
233
234
  // Login details tracking not configured
235
+ console.warn('⚠️ loginDetailsRepo not configured. Add loginDetailsRepo to AuthCoreModule repositories.');
234
236
  return;
235
237
  }
236
238
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecrs-auth-core",
3
- "version": "1.0.75",
3
+ "version": "1.0.76",
4
4
  "description": "Centralized authentication and authorization module for ECRS apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",