I work on web application asp.net core 5 i can't modify action login
to accept 3 login attempt failed only .
if he try with wrong password or wrong email account after that then block it .
I using user identity login
what I try
public async Task Login(LoginVM loginVM)
{
if (!ModelState.IsValid) return View(loginVM);
var user = await _userManager.FindByEmailAsync(loginVM.EmailAddress);
if(user != null)
{
var passwordCheck = await _userManager.CheckPasswordAsync(user, loginVM.Password);
if (passwordCheck)
{
var result = await _signInManager.PasswordSignInAsync(user, loginVM.Password, false, false);
if (result.Succeeded)
{
return RedirectToAction("Index", "Movies");
}
}
TempData["Error"] = "Wrong credentials. Please, try again!";
return View(loginVM);
}
TempData["Error"] = "Wrong credentials. Please, try again!";
return View(loginVM);
}
can you help me by solution general working as session without using identity membership so i can use it on another login or another logic
Amit MohantyPosted Dec 2, 2022, 5:08 AM
Check the below links
https://code-maze.com/user-lockout-aspnet-core-identity/
https://hoven.in/aspnet-core/acc-lockout-identity.html
Pankajkumar PatelPosted Dec 2, 2022, 4:10 AM
Hi Ahmed Salah,
For this there is one article "Spring Security Limit Login Attempts Example" with full example and link is as below:
Hope this will help you!