Starts in:
2 DAYS
9 HRS
28 MIN
39 SEC
Starts in:
2 D
9 H
28 M
39 S
Open Closed

Angular: How to use default Password Validator for customized user form? #541


User avatar
0
bozkan created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v3.0.0
  • UI type: Angular
  • Tiered (MVC) or Identity Server Seperated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hello , We use customized form component for adding new user and I want to use Abp's password validator that has configured according to password settings already. Is there any method or way to to use it for my component as well ? You can see the screenshot of the validator that I mentioned.

ABP :

Ours:

Thank you


3 Answer(s)
  • User Avatar
    0
    bunyamin created

    Hello,

    It is available within @abp/ng.theme.shared package. You find an example of usage here

    You can find the code of the function, getPasswordValidators

    It is a simple function that takes injector.

    setPasswordForm = this.fb.group({
        newPassword: ['', [Validators.required, ...getPasswordValidators(this.injector)]],
    });
    
  • User Avatar
    0
    bozkan created

    Hi , I get following error and when I check the getPasswordValidators method saw that it expects the Store type object , could you please check it too?

    Argument of type 'Injector' is not assignable to parameter of type 'Store'. Type 'Injector' is missing the following properties from type 'Store': stateStream, internalStateOperations, config, internalExecutionStrategy, and 10 more.ts(2345)

    Thank you

  • User Avatar
    0
    bunyamin created

    Hello,

    In the latest version of ABP, we replaced the Store parameter with Injector. Since you are running an early version, you should pass Store instead of Injector

    You can find the related commit here

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06