Skip to content

Commit

Permalink
V2Wizard: Improve validators
Browse files Browse the repository at this point in the history
Follow up to #1548

This cleans up implementation for the AWS account ID ad GCP e-mail validators.
  • Loading branch information
regexowl authored and lucasgarfield committed Jan 15, 2024
1 parent 3ed2192 commit 55686cc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/Components/CreateImageWizardV2/validators.ts
Original file line number Diff line number Diff line change
@@ -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;
);
};

0 comments on commit 55686cc

Please sign in to comment.