File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 7979 "react-dom" : " ^16.8.6" ,
8080 "ts-node" : " ^8.5.2" ,
8181 "typescript" : " 4.2.4" ,
82- "uuid" : " ^7.0.3"
82+ "uuid" : " ^7.0.3" ,
83+ "validator" : " ^13.15.20"
8384 },
8485 "devDependencies" : {
8586 "@graphql-codegen/cli" : " ^1.21.8" ,
9394 "@types/jest" : " ^24.0.11" ,
9495 "@types/lodash" : " ^4.14.122" ,
9596 "@types/node" : " ^14.17.1" ,
97+ "@types/validator" : " ^13.15.4" ,
9698 "concurrently" : " ^4.1.0" ,
9799 "husky" : " ^1.3.1" ,
98100 "jest" : " ^24.3.1" ,
Original file line number Diff line number Diff line change 1+ import validator from 'validator'
12import {
23 IUserInfo ,
34 requestGroups ,
@@ -13,6 +14,10 @@ export async function assignUserToGroups(userInfo: IUserInfo): Promise<IUserInfo
1314 return userInfo
1415 }
1516
17+ if ( ! validator . isEmail ( userInfo . email ) ) {
18+ return userInfo
19+ }
20+
1621 const settings = await getSettings ( )
1722 const domainGroups = settings . domain_groups
1823 const autoDomainGroups = settings . auto_domain_groups
@@ -31,7 +36,11 @@ export async function assignUserToGroups(userInfo: IUserInfo): Promise<IUserInfo
3136 )
3237
3338 const sessionGroups = userInfo . groups
34- const emailDomainGroups = assignGroups . filter ( ( dg ) => userInfo . email . endsWith ( dg . domain ) )
39+ const parsedDomains = userInfo . email . split ( '@' )
40+ const emailDomain = parsedDomains [ parsedDomains . length - 1 ] ?. toLowerCase ( )
41+ const emailDomainGroups = assignGroups . filter (
42+ ( dg ) => emailDomain === dg . domain . toLowerCase ( )
43+ )
3544 const groupAssignments = uniq ( flatten ( emailDomainGroups . map ( ( { groups } ) => groups ) ) )
3645 const assignToGroups = difference ( groupAssignments , sessionGroups )
3746
Original file line number Diff line number Diff line change 23002300 resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e"
23012301 integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ==
23022302
2303+ " @types/validator@^13.15.4 " :
2304+ version "13.15.4"
2305+ resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.15.4.tgz#38a97ae54747416f745afdfc678f041713082635"
2306+ integrity sha512-LSFfpSnJJY9wbC0LQxgvfb+ynbHftFo0tMsFOl/J4wexLnYMmDSPaj2ZyDv3TkfL1UePxPrxOWJfbiRS8mQv7A==
2307+
2303230823042309 version "1.0.2"
23052310 resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.2.tgz#d2855c6a312b7da73ed16ba6781815bf30c6187a"
@@ -10939,6 +10944,11 @@ validate-npm-package-license@^3.0.1:
1093910944 spdx-correct "^3.0.0"
1094010945 spdx-expression-parse "^3.0.0"
1094110946
10947+ validator@^13.15.20 :
10948+ version "13.15.20"
10949+ resolved "https://registry.yarnpkg.com/validator/-/validator-13.15.20.tgz#054e9238109538a1bf46ae3e1290845a64fa2186"
10950+ integrity sha512-KxPOq3V2LmfQPP4eqf3Mq/zrT0Dqp2Vmx2Bn285LwVahLc+CsxOM0crBHczm8ijlcjZ0Q5Xd6LW3z3odTPnlrw==
10951+
10942109521094310953 version "1.0.11"
1094410954 resolved "https://registry.yarnpkg.com/value-or-promise/-/value-or-promise-1.0.11.tgz#3e90299af31dd014fe843fe309cefa7c1d94b140"
You can’t perform that action at this time.
0 commit comments