1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 23:33:31 +00:00

SG-680 - Updated Domain Name custom validator to pass back error message in format the error.component.ts expected so it can be displayed without an untranslated error prefix of "invalidDomainName"

This commit is contained in:
Jared Snider
2022-12-08 16:15:13 -05:00
parent f528c4ba5a
commit 98917ce06d

View File

@@ -11,7 +11,11 @@ export function domainNameValidator(errorMessage: string): ValidatorFn {
const forbiddenPatterns = [/^https:\/\//, /^http:\/\//, /^www\./];
for (const pattern of forbiddenPatterns) {
if (pattern.test(control.value)) {
return { invalidDomainName: errorMessage };
return {
invalidDomainName: {
message: errorMessage,
},
};
}
}
return null;