Browse Source
refactor: simplify error handling in AbpTwoFactorTokenProvider
pull/25316/head
maliming
2 weeks ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
2 additions and
5 deletions
-
modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo/Abp/Identity/AspNetCore/AbpTwoFactorTokenProvider.cs
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.Globalization; |
|
|
|
using System.Linq; |
|
|
|
using System.Security.Cryptography; |
|
|
|
using System.Text; |
|
|
|
using System.Threading.Tasks; |
|
|
|
@ -126,14 +125,12 @@ public abstract class AbpTwoFactorTokenProvider : IUserTwoFactorTokenProvider<Id |
|
|
|
} |
|
|
|
|
|
|
|
// Translate ConcurrencyStamp failure (another request won the consume race) to false,
|
|
|
|
// so legitimate concurrent verification doesn't surface as a 500. Other persistence
|
|
|
|
// failures propagate so operators can see real errors.
|
|
|
|
// so legitimate concurrent verification doesn't surface as a 500.
|
|
|
|
try |
|
|
|
{ |
|
|
|
await RemoveStoredTokenAsync(manager, user, tokenName); |
|
|
|
} |
|
|
|
catch (AbpIdentityResultException ex) when ( |
|
|
|
ex.IdentityResult.Errors.Any(e => e.Code == nameof(IdentityErrorDescriber.ConcurrencyFailure))) |
|
|
|
catch (AbpIdentityResultException) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|