嗨,我有一个返回数组对象 passwordPolicy 的 api,其中包含
PasswordMinLength: 6
passwordMinLowerCase: 1
passwordMinNumber: 1
passwordMinSymbol: 0
passwordMinUpperCase: 1
数字可以根据用户的角色不断变化,例如它可以是
PasswordMinLength: Password min length.
PasswordMinLowerCase: This is currently either 0 or 1 So, if it's returning 1 for example it should have 1 minimum lower case. If it's returning 0 then the check should be ignored for lower case.
PasswordMinUpperCase: Same as above for upper case requirement.
PasswordMinSymbol: Same as above for symbol.
PasswordMinNumber: same as above to determine if a number is required in the password.
我知道我们可以使用正则表达式模式验证进行验证,请参见下面的 如何使用 Angular 5 验证器模式验证密码强度
但是当数据不断变化时如何动态地实现验证。
我需要验证 newpwdctrlname。
resetPwdForm: FormGroup = new FormGroup({
newpwdctrlname: new FormControl('', [Validators.required, Validators.minLength(6)]),
shownewpwdctrlname: new FormControl('', []),
rptpwdctrlname: new FormControl('', [Validators.required])
});