mirror of https://github.com/abpframework/abp.git
committed by
GitHub
2 changed files with 44 additions and 0 deletions
@ -0,0 +1,33 @@ |
|||
using JetBrains.Annotations; |
|||
using Microsoft.AspNetCore.Identity; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Localization; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Identity.Localization; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Volo.Abp.Identity; |
|||
|
|||
[Dependency(ServiceLifetime.Scoped, ReplaceServices = true)] |
|||
[ExposeServices(typeof(IdentityErrorDescriber))] |
|||
public class AbpIdentityErrorDescriber : IdentityErrorDescriber |
|||
{ |
|||
protected IStringLocalizer<IdentityResource> Localizer { get; } |
|||
|
|||
public AbpIdentityErrorDescriber(IStringLocalizer<IdentityResource> localizer) |
|||
{ |
|||
Localizer = localizer; |
|||
} |
|||
|
|||
public override IdentityError InvalidUserName([CanBeNull] string userName) |
|||
{ |
|||
using (CultureHelper.Use("en")) |
|||
{ |
|||
return new IdentityError |
|||
{ |
|||
Code = nameof(InvalidUserName), |
|||
Description = Localizer["Volo.Abp.Identity:InvalidUserName", userName ?? ""] |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue