Open Closed

Question on password requirements #6286


User avatar
0
balessi75 created

ABP Commercial 7.4.2 / Blazor Server / EF / Non tiered / Separate Host and Tenant DBs / Lepton Theme

Hi,

How can I get the password complexity requirements setup in ABP Settings for use in JS on the front-end Registration page?

Is there a Service that can be injected for use in the Registration page?

I tried the following, but it returns the default password settings from MS instead of the values set in the ABP Settings page.

private readonly IdentityOptions _identityOptions;

public nVisionRegisterModel(IOptions<IdentityOptions> identityOptions) : base ()
{
    _identityOptions = identityOptions.Value;

}

Thanks in advance!


2 Answer(s)
  • User Avatar
    0
    balessi75 created

    For anyone running into the same issue, you just need to inject ABP's ISettingProvider

    See ABP's documentation

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    ABP will override the default value using the setting value

    https://github.com/abpframework/abp/blob/260507ff4ed476d42efbd2012c545adf99bb0c28/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsManager.cs

    You need to call the SetAsync first: https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs

    protected IOptions<IdentityOptions> IdentityOptions { get; }
    
    ....
    
    await IdentityOptions.SetAsync();
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11