I work on web application asp.net mvc core .net 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 .
so how to using session to allow user enter three time password wrong
after three time account will blocked
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
What I have tried:
[HttpPost]
public async Task<IActionResult> 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);
}