mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-05 22:02:15 +00:00
# Which Problems Are Solved Allows users to be created using the V2 User API # How the Problems Are Solved I added a seperate V2 create user page with the new code using the new apis. # Additional Changes I did some refactorings arround our interceptors as they used an obselete syntax. The password complexity form takes the Buf definitions. # Additional Context - Closes #9430 --------- Co-authored-by: Max Peintner <[email protected]>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { ValidatorFn } from '@angular/forms';
|
|
import {
|
|
containsLowerCaseValidator,
|
|
containsNumberValidator,
|
|
containsSymbolValidator,
|
|
containsUpperCaseValidator,
|
|
minLengthValidator,
|
|
requiredValidator,
|
|
} from '../modules/form-field/validators/validators';
|
|
import { PasswordComplexityPolicy } from '@zitadel/proto/zitadel/policy_pb';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class PasswordComplexityValidatorFactoryService {
|
|
constructor() {}
|
|
|
|
buildValidators(policy?: PasswordComplexityPolicy) {
|
|
const validators: ValidatorFn[] = [requiredValidator];
|
|
if (policy?.minLength) {
|
|
validators.push(minLengthValidator(Number(policy.minLength)));
|
|
}
|
|
if (policy?.hasLowercase) {
|
|
validators.push(containsLowerCaseValidator);
|
|
}
|
|
if (policy?.hasUppercase) {
|
|
validators.push(containsUpperCaseValidator);
|
|
}
|
|
if (policy?.hasNumber) {
|
|
validators.push(containsNumberValidator);
|
|
}
|
|
if (policy?.hasSymbol) {
|
|
validators.push(containsSymbolValidator);
|
|
}
|
|
return validators;
|
|
}
|
|
}
|