If condition to NOP
This commit is contained in:
parent
d8438c9398
commit
c260beab52
|
|
@ -1784,6 +1784,12 @@ namespace Microsoft.AspNet.Identity
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("user");
|
throw new ArgumentNullException("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (await GetAccessFailedCountAsync(user) == 0)
|
||||||
|
{
|
||||||
|
return IdentityResult.Success;
|
||||||
|
}
|
||||||
|
|
||||||
await store.ResetAccessFailedCountAsync(user, CancellationToken);
|
await store.ResetAccessFailedCountAsync(user, CancellationToken);
|
||||||
return await LogResultAsync(await UpdateUserAsync(user), user);
|
return await LogResultAsync(await UpdateUserAsync(user), user);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -627,6 +627,20 @@ namespace Microsoft.AspNet.Identity.Test
|
||||||
BadPasswordValidator<TestUser>.ErrorMessage);
|
BadPasswordValidator<TestUser>.ErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task ResetTokenCallNoopForTokenValueZero()
|
||||||
|
{
|
||||||
|
var user = new IdentityUser() { UserName = Guid.NewGuid().ToString()};
|
||||||
|
var store = new Mock<IUserLockoutStore<IdentityUser>>();
|
||||||
|
store.Setup(x => x.ResetAccessFailedCountAsync(user, It.IsAny<CancellationToken>())).Returns(() =>
|
||||||
|
{
|
||||||
|
throw new Exception();
|
||||||
|
});
|
||||||
|
var manager = MockHelpers.TestUserManager(store.Object);
|
||||||
|
|
||||||
|
IdentityResultAssert.IsSuccess(await manager.ResetAccessFailedCountAsync(user));
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task ManagerPublicNullChecks()
|
public async Task ManagerPublicNullChecks()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue