From 8edd99e1588447209b9fffa233b081d93b274770 Mon Sep 17 00:00:00 2001 From: Oleg Zhuk Date: Fri, 17 Nov 2023 21:37:29 +0200 Subject: [PATCH] PT-14407: The attempt counter does not reset when logging in fix: The attempt counter does not reset when logging in --- VirtoCommerce.Storefront/Controllers/AccountController.cs | 5 +++-- .../Controllers/Api/ApiAccountController.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/VirtoCommerce.Storefront/Controllers/AccountController.cs b/VirtoCommerce.Storefront/Controllers/AccountController.cs index af58e7df..14bcb847 100644 --- a/VirtoCommerce.Storefront/Controllers/AccountController.cs +++ b/VirtoCommerce.Storefront/Controllers/AccountController.cs @@ -121,10 +121,11 @@ private async Task SignOutAndSignInAsync(User user) await SetLastLoginDate(user); } - private async Task SetLastLoginDate(User user) + private Task SetLastLoginDate(User user) { user.LastLoginDate = DateTime.UtcNow; - await _signInManager.UserManager.UpdateAsync(user); + user.AccessFailedCount = 0; + return _signInManager.UserManager.UpdateAsync(user); } } } diff --git a/VirtoCommerce.Storefront/Controllers/Api/ApiAccountController.cs b/VirtoCommerce.Storefront/Controllers/Api/ApiAccountController.cs index e9ca3af8..8ff8774a 100644 --- a/VirtoCommerce.Storefront/Controllers/Api/ApiAccountController.cs +++ b/VirtoCommerce.Storefront/Controllers/Api/ApiAccountController.cs @@ -528,10 +528,11 @@ private async Task SendNotificationAsync(NotificationBas return result; } - private async Task SetLastLoginDate(User user) + private Task SetLastLoginDate(User user) { user.LastLoginDate = DateTime.UtcNow; - await _signInManager.UserManager.UpdateAsync(user); + user.AccessFailedCount = 0; + return _signInManager.UserManager.UpdateAsync(user); } // GET: storefrontapi/account/passwordrequirements