From 39805fd03176adf9afadef607049741ebbe0ecbf Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 14 Aug 2023 09:15:26 +0800 Subject: [PATCH] Output security logs correctly. Resolve #17361 --- .../Controllers/TokenController.Password.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs index 33b01a7449..9617d4f409 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs @@ -96,6 +96,14 @@ public partial class TokenController var result = await SignInManager.CheckPasswordSignInAsync(user, request.Password, true); if (!result.Succeeded) { + await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext + { + Identity = OpenIddictSecurityLogIdentityConsts.OpenIddict, + Action = result.ToIdentitySecurityLogAction(), + UserName = request.Username, + ClientId = request.ClientId + }); + string errorDescription; if (result.IsLockedOut) { @@ -138,14 +146,6 @@ public partial class TokenController return await HandleTwoFactorLoginAsync(request, user); } - await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext - { - Identity = OpenIddictSecurityLogIdentityConsts.OpenIddict, - Action = result.ToIdentitySecurityLogAction(), - UserName = request.Username, - ClientId = request.ClientId - }); - return await SetSuccessResultAsync(request, user); } }