0

I have an asp.net web site with oauth2 authentification. I need to manually lock/unlock users permanently but I can't find standart method in ApplicationUser. The closest thing I could have done is setting LockoutEndDateUtc like this

user.LockoutEndDateUtc = DateTime.Now.AddYears(100);

But this is kinda gimmicky. Is there standard way of doing this? Am I getting something wrong. If I can manipulate these things from outside why isn't there just Lock/Unlock method or IsLocked property?

1 Answers1

0

Hopefully you are getting your use base from DB; probably a users table (for example). You can have a column like IsLocked bit. While checking against DB check for that IsLocked and if true and then deny login of user and throw a message saying you are locked.

Rahul
  • 76,197
  • 13
  • 71
  • 125
  • Thanks, didn't want to modify DB structure. It Just seemed strange to me that I can lock users by playing with other variables but there is no simple obvious way to do this – Максим Божко Sep 05 '16 at 11:53