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

Viewed 12576

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.

2 Answers

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.

Once LockoutEnd has a future date then the user is considered locked out whether LockoutEnabled is true or false. LockoutEnabled is used when determining if the current user should be locked out such as when entering too many incorrect passwords. In other words, if LockoutEnd has a date in the future then the user is locked out, even if LockoutEnabled is false, .

Related