Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify # of failed login attempts for account lock in MVC 4 w/ default simplemembership provider

How can you specify the # of failed logon attempts with the default simplemembership provider in ASP.NET MVC 4? I see there is an unlock account method but I don't see anywhere you can specify the # of failed attempts that cause the account to lock. If you were specifying it in MVC 3 you could specify maxInvalidPasswordAttempts in web.config under the provider. However, with MVC4 simplemembership you don't set up the provider in web.config.

like image 668
Xaxum Avatar asked Oct 11 '12 20:10

Xaxum


People also ask

What does it mean to specify something?

Definition of specify transitive verb. 1 : to name or state explicitly or in detail. 2 : to include as an item in a specification. Other Words from specify Synonyms Example Sentences Phrases Containing specify Learn More About specify.

Can u specify meaning?

To explicitly name something or state a particular detail, you specify that thing. So, when you have a craving for dessert and you send someone to the store to buy ice cream, you may want to specify a flavor. If you assign something for a particular purpose, this verb means that you specify.

What is the purpose of specify?

specify | Business Englishto state or describe something clearly and exactly: He said we should meet but didn't specify a time.


1 Answers

It turns out simplemembership provider tracks the failed logins but it is up to you to catch the failed login attempts on user login with something like...

if(WebSecurity.IsAccountLockedOut(model.UserName,4,10000)){
                    return RedirectToAction("LockedAccount");
                }

Which of course leads to how to log them in once they reset their password. I chose to log them in directly in the password reset action. I could have put another field in the userprofile to track password being reset and bypass the check but figured it was not worth it.

like image 175
Xaxum Avatar answered Sep 28 '22 19:09

Xaxum