Search code examples
asp.net-coreasp.net-identityasp.net-core-identity

What is Asp.net Core 2.1 Identity's LockoutEnabled property actually for?


I'm using Asp.net Core 2.1 Identity and there is a property named "LockoutEnabled", for a second I thought this flag determines whether a user is locked out or not.  But the doc says it is

"a flag indicating if the user could be locked out"

So what is this property for?  And is the lock out feature actually implemented in this version of the library?  Thanks.


Solution

  • It is used to enable a user lockout for a specific period of time.
    If you set LockoutEnabled to true and add a LockoutEnd date, you'll prevent that user from logging in again until after the LockoutEnd date is reached.
    If only the LockoutEnabled flag is set to true, with no LockoutEnd date set, it just means that the user can be locked out, but is not locked out.