I\'m trying to find a way to disable a user in Identity 2.0 and can\'t seem to find any info on it.
I would like to basically set a user to IsActive=false and would
Was doing some research on this and turns out the IdentityUser
base class has some properties related to this topic. Namely: LockoutEnabled
and LockoutEndDateUtc
.
It's sufficient to set LockoutEnabled
to true
and LockoutEndDateUtc
to some future date in order for the standard SignInManager.PasswordSignInAsync
to pick it up and act accordingly without any overrides or customizations.
And if you want to just disable the user without specifying any exact date of reactivation you can just set it to DateTime.MaxValue
.