I'm trying to do something like this:
After the fifth attempt to login, captcha will be displayed, not before that.
I've added LoginAttemptCount property to LoginModel, and on every WrongPassword case I am increasing it by 1.
Basicly it should work, but i don't know what i'm missing.
public partial class LoginModel : BaseNopModel
{
public bool CheckoutAsGuest { get; set; }
[NopResourceDisplayName("Account.Login.Fields.Email")]
[AllowHtml]
public string Email { get; set; }
public bool UsernamesEnabled { get; set; }
[NopResourceDisplayName("Account.Login.Fields.UserName")]
[AllowHtml]
public string Username { get; set; }
[DataType(DataType.Password)]
[NopResourceDisplayName("Account.Login.Fields.Password")]
[AllowHtml]
public string Password { get; set; }
[NopResourceDisplayName("Account.Login.Fields.RememberMe")]
public bool RememberMe { get; set; }
public bool DisplayCaptcha { get; set; }
public int LoginAttemptCount { get; set; }
}
@if (Model.DisplayCaptcha && Model.LoginAttemptCount >= 5)
{
<div class="captcha-box">
@Html.Raw(Html.GenerateCaptcha())
@*<div class="g-recaptcha" data-sitekey="xxxxxx"></div>*@
</div>
}