BTCPay-infrastructure-recovery
This commit is contained in:
@@ -44,9 +44,15 @@ public class PushNotificationController : ControllerBase
|
||||
try
|
||||
{
|
||||
var userIdClaim = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
var username = User.FindFirst(ClaimTypes.Name)?.Value ?? User.Identity?.Name;
|
||||
|
||||
// Debug logging
|
||||
var logger = HttpContext.RequestServices.GetRequiredService<ILogger<PushNotificationController>>();
|
||||
logger.LogInformation("Push subscription attempt - UserIdClaim: {UserIdClaim}, Username: {Username}", userIdClaim, username);
|
||||
|
||||
if (string.IsNullOrEmpty(userIdClaim) || !Guid.TryParse(userIdClaim, out Guid userId))
|
||||
{
|
||||
return Unauthorized("Invalid user ID");
|
||||
return Unauthorized(new { error = "Invalid user ID", userIdClaim, username });
|
||||
}
|
||||
|
||||
var userAgent = Request.Headers.UserAgent.ToString();
|
||||
@@ -65,6 +71,8 @@ public class PushNotificationController : ControllerBase
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var logger = HttpContext.RequestServices.GetRequiredService<ILogger<PushNotificationController>>();
|
||||
logger.LogError(ex, "Push subscription error");
|
||||
return StatusCode(500, new { error = ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user