V2Wizard: Improve validators
Follow up to https://github.com/RedHatInsights/image-builder-frontend/pull/1548 This cleans up implementation for the AWS account ID ad GCP e-mail validators.
This commit is contained in:
parent
3ed2192358
commit
55686cc844
1 changed files with 4 additions and 10 deletions
|
|
@ -1,21 +1,15 @@
|
|||
export const isAwsAccountIdValid = (awsAccountId: string | undefined) => {
|
||||
if (
|
||||
return (
|
||||
awsAccountId !== undefined &&
|
||||
/^\d+$/.test(awsAccountId) &&
|
||||
awsAccountId.length === 12
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
);
|
||||
};
|
||||
|
||||
export const isGcpEmailValid = (gcpShareWithAccount: string | undefined) => {
|
||||
if (
|
||||
return (
|
||||
gcpShareWithAccount !== undefined &&
|
||||
/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,12}$/.test(gcpShareWithAccount) &&
|
||||
gcpShareWithAccount.length <= 253
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue