Skip to content

Commit 67bc7ee

Browse files
authored
Merge pull request #61922 from dotnet/wtgodbe/Port23
[release/2.3] Merge internal commits for May
2 parents 1053dec + a384465 commit 67bc7ee

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

eng/PatchConfig.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Later on, this will be checked using this condition:
2020
</PropertyGroup>
2121
<PropertyGroup Condition=" '$(VersionPrefix)' == '2.3.2' ">
2222
<PackagesInPatch>
23+
Microsoft.Extensions.Identity.Stores;
2324
</PackagesInPatch>
2425
</PropertyGroup>
2526
</Project>

src/Identity/EntityFrameworkCore/test/EF.Test/UserStoreTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ await Assert.ThrowsAsync<ArgumentNullException>("user",
165165
await Assert.ThrowsAsync<ArgumentNullException>("user", async () => await store.GetTwoFactorEnabledAsync(null));
166166
await Assert.ThrowsAsync<ArgumentNullException>("user",
167167
async () => await store.SetTwoFactorEnabledAsync(null, true));
168+
await Assert.ThrowsAsync<ArgumentNullException>("user", async () => await store.RedeemCodeAsync(user: null, code: "fake", default));
169+
await Assert.ThrowsAsync<ArgumentNullException>("code", async () => await store.RedeemCodeAsync(new IdentityUser("fake"), code: null, default));
170+
await Assert.ThrowsAsync<ArgumentException>("code", async () => await store.RedeemCodeAsync(new IdentityUser("fake"), code: "", default));
168171
await Assert.ThrowsAsync<ArgumentNullException>("user", async () => await store.GetAccessFailedCountAsync(null));
169172
await Assert.ThrowsAsync<ArgumentNullException>("user", async () => await store.GetLockoutEnabledAsync(null));
170173
await Assert.ThrowsAsync<ArgumentNullException>("user", async () => await store.SetLockoutEnabledAsync(null, false));

src/Identity/Extensions.Stores/src/UserStoreBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,10 @@ public virtual async Task<bool> RedeemCodeAsync(TUser user, string code, Cancell
10601060
{
10611061
throw new ArgumentNullException(nameof(code));
10621062
}
1063+
if (code.Length == 0)
1064+
{
1065+
throw new ArgumentException("Must not be null or empty", nameof(code));
1066+
}
10631067

10641068
var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken) ?? "";
10651069
var splitCodes = mergedCodes.Split(';');

0 commit comments

Comments
 (0)