diff --git a/Marco.Pms.Model/Dtos/Authentication/LoginDto.cs b/Marco.Pms.Model/Dtos/Authentication/LoginDto.cs
index 18ff0ae..5e32c8b 100644
--- a/Marco.Pms.Model/Dtos/Authentication/LoginDto.cs
+++ b/Marco.Pms.Model/Dtos/Authentication/LoginDto.cs
@@ -5,11 +5,4 @@
public required string Username { get; set; }
public required string Password { get; set; }
}
-
- public class MobileLoginDto
- {
- public required string Username { get; set; }
- public required string Password { get; set; }
- public required string FcmToken { get; set; }
- }
}
diff --git a/Marco.Pms.Services/Controllers/AuthController.cs b/Marco.Pms.Services/Controllers/AuthController.cs
index d2944a0..784bf00 100644
--- a/Marco.Pms.Services/Controllers/AuthController.cs
+++ b/Marco.Pms.Services/Controllers/AuthController.cs
@@ -127,7 +127,7 @@ namespace MarcoBMS.Services.Controllers
/// An IActionResult containing the authentication tokens or an error response.
[HttpPost("login-mobile")]
- public async Task LoginMobile([FromBody] MobileLoginDto loginDto)
+ public async Task LoginMobile([FromBody] LoginDto loginDto)
{
// Log the start of the login attempt for traceability.
_logger.LogInfo("Login attempt initiated for user: {Username}", loginDto.Username ?? "N/A");
@@ -225,33 +225,6 @@ namespace MarcoBMS.Services.Controllers
// Return a successful response with the generated tokens.
_logger.LogInfo("User {Username} logged in successfully.", user.UserName);
- var existingFCMTokenMapping = await _context.FCMTokenMappings.Where(ft => ft.FcmToken == loginDto.FcmToken).ToListAsync();
-
- if (existingFCMTokenMapping.Any())
- {
- _context.FCMTokenMappings.RemoveRange(existingFCMTokenMapping);
- }
-
- var fcmTokenMapping = new FCMTokenMapping
- {
- EmployeeId = emp.Id,
- FcmToken = loginDto.FcmToken,
- ExpiredAt = DateTime.UtcNow.AddDays(6),
- TenantId = emp.TenantId
- };
- _context.FCMTokenMappings.Add(fcmTokenMapping);
-
- _logger.LogInfo("New FCM Token registering for employee {EmployeeId}", emp.Id);
-
- _ = Task.Run(async () =>
- {
- // --- Push Notification Section ---
- // This section attempts to send a test push notification to the user's device.
- // It's designed to fail gracefully and handle invalid Firebase Cloud Messaging (FCM) tokens.
- await _firebase.SendLoginOnAnotherDeviceMessageAsync(emp.Id, loginDto.FcmToken, tenantId);
-
- });
-
try
{
await _context.SaveChangesAsync();