암호 복잡성 적용을 아직 찾지 못했습니다. MVC에 익숙하지 않습니다. 그러나 SimpleMembership의 로그인 메소드에는 무시 횟수와 잠금 기간 (초)을 지정하는 오버라이드가 있습니다. 다음은 3 회 시도 후에 계정을 잠그는 로그인 POST 컨트롤러 동작의 예입니다.
public ActionResult Login(LoginModel model, string returnUrl)
{
if (ModelState.IsValid)
{
if (WebSecurity.IsAccountLockedOut(model.UserName, 3, 300))
{
ModelState.AddModelError("", "Your account has been locked due to excessive log in failures. Please try again in 5 minutes.");
return View(model);
}
else if (WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
{
return RedirectToLocal(returnUrl);
}
}
// If we got this far, something failed, redisplay form
ModelState.AddModelError("", "The user name or password provided is incorrect.");
return View(model);
}