Fix for User null from IP address "::1" has logged out (#14322)

(cherry picked from commit dd59ef17f5)
This commit is contained in:
Russell
2023-05-31 22:46:02 +12:00
committed by Sebastiaan Janssen
parent b716e98780
commit aa4a1b3498

View File

@@ -624,7 +624,7 @@ public class AuthenticationController : UmbracoApiControllerBase
await _signInManager.SignOutAsync();
_logger.LogInformation("User {UserName} from IP address {RemoteIpAddress} has logged out",
User.Identity == null ? "UNKNOWN" : User.Identity.Name, HttpContext.Connection.RemoteIpAddress);
result.Principal.Identity == null ? "UNKNOWN" : result.Principal.Identity.Name, HttpContext.Connection.RemoteIpAddress);
var userId = result.Principal.Identity?.GetUserId();
SignOutSuccessResult args = _userManager.NotifyLogoutSuccess(User, userId);