解决方法
在即将发布的2.0身份版本中,支持帐号锁定
组态:
manager.UserLockoutEnabledByDefault = true; // Enables ability to lockout for users when created manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5); manager.MaxFailedAccessAttemptsBeforeLockout = 5;
用法:
manager.IsLockedOutAsync(user.Id) // Check for lockout manager.ResetAccessFailedCountAsync(user.Id); // Clear Failed count after success manager.AccessFailedAsync(user.Id); // Record a failure (this will lockout if enabled) manager.SetLockoutEnabled(user.Id,enabled) // Enables or disables lockout for a user