Skip to content

Commit 55da28c

Browse files
Merge pull request #753 from devtron-labs/feat/gatekeeper-magic-link
feat: gatekeeper magic link
2 parents a5a07ce + 8ca7525 commit 55da28c

File tree

6 files changed

+31
-3
lines changed

6 files changed

+31
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.14.1-pre-6",
3+
"version": "1.14.1-pre-7",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Assets/IconV2/ic-email.svg

Lines changed: 3 additions & 0 deletions
Loading

src/Common/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const PATTERNS = {
4141
CONFIG_MAP_AND_SECRET_KEY: /^[-._a-zA-Z0-9]+$/,
4242
CONFIGMAP_AND_SECRET_NAME: /^[a-z0-9][a-z0-9-.]*[a-z0-9]$/,
4343
ALPHANUMERIC_WITH_SPECIAL_CHAR_AND_SLASH: /^[A-Za-z0-9._/-]+$/, // allow alphanumeric,(.) ,(-),(_),(/)
44+
EMAIL: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
4445
}
4546

4647
const GLOBAL_CONFIG_TEMPLATES_DEVTRON_APP = '/global-config/templates/devtron-apps'

src/Shared/Components/Icon/Icon.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import { ReactComponent as ICDiscordFill } from '@IconsV2/ic-discord-fill.svg'
5959
import { ReactComponent as ICDockerhub } from '@IconsV2/ic-dockerhub.svg'
6060
import { ReactComponent as ICEcr } from '@IconsV2/ic-ecr.svg'
6161
import { ReactComponent as ICEdit } from '@IconsV2/ic-edit.svg'
62+
import { ReactComponent as ICEmail } from '@IconsV2/ic-email.svg'
6263
import { ReactComponent as ICEnterpriseFeat } from '@IconsV2/ic-enterprise-feat.svg'
6364
import { ReactComponent as ICEnterpriseTag } from '@IconsV2/ic-enterprise-tag.svg'
6465
import { ReactComponent as ICEnv } from '@IconsV2/ic-env.svg'
@@ -223,6 +224,7 @@ export const iconMap = {
223224
'ic-dockerhub': ICDockerhub,
224225
'ic-ecr': ICEcr,
225226
'ic-edit': ICEdit,
227+
'ic-email': ICEmail,
226228
'ic-enterprise-feat': ICEnterpriseFeat,
227229
'ic-enterprise-tag': ICEnterpriseTag,
228230
'ic-env': ICEnv,

src/Shared/validations.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,3 +497,25 @@ export const validateYAML = (yamlString: string, isRequired?: boolean): Validati
497497
}
498498
}
499499
}
500+
501+
export const validateEmail = (email: string): ValidationResponseType => {
502+
if (!email) {
503+
return {
504+
isValid: false,
505+
message: 'Email is required',
506+
}
507+
}
508+
509+
const result = PATTERNS.EMAIL.test(String(email).toLowerCase())
510+
511+
if (result) {
512+
return {
513+
isValid: true,
514+
}
515+
}
516+
517+
return {
518+
isValid: false,
519+
message: 'Please provide a valid email address',
520+
}
521+
}

0 commit comments

Comments
 (0)