Skip to content

Commit dbd7852

Browse files
authored
189/prevent emails not approved by insurance (#326)
* Added check on the user profile update form * Added email verification on virtual lab creation * Fix linting issue * PR feedbacks
1 parent 3ada413 commit dbd7852

File tree

8 files changed

+327
-196
lines changed

8 files changed

+327
-196
lines changed

public/static/country.ts

Lines changed: 119 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default [
1+
const COUNTRIES = [
22
{
33
alpha2: 'AC',
44
alpha3: 'ASC',
@@ -32,17 +32,6 @@ export default [
3232
name: 'United Arab Emirates',
3333
status: 'assigned',
3434
},
35-
{
36-
alpha2: 'AF',
37-
alpha3: 'AFG',
38-
countryCallingCodes: ['+93'],
39-
currencies: ['AFN'],
40-
emoji: '🇦🇫',
41-
ioc: 'AFG',
42-
languages: ['pus'],
43-
name: 'Afghanistan',
44-
status: 'assigned',
45-
},
4635
{
4736
alpha2: 'AG',
4837
alpha3: 'ATG',
@@ -435,17 +424,6 @@ export default [
435424
name: 'Botswana',
436425
status: 'assigned',
437426
},
438-
{
439-
alpha2: 'BY',
440-
alpha3: 'BLR',
441-
countryCallingCodes: ['+375'],
442-
currencies: ['BYN'],
443-
emoji: '🇧🇾',
444-
ioc: 'BLR',
445-
languages: ['bel', 'rus'],
446-
name: 'Belarus',
447-
status: 'assigned',
448-
},
449427
{
450428
alpha2: 'BY',
451429
alpha3: 'BYS',
@@ -651,17 +629,6 @@ export default [
651629
name: 'Canton and Enderbury Islands',
652630
status: 'deleted',
653631
},
654-
{
655-
alpha2: 'CU',
656-
alpha3: 'CUB',
657-
countryCallingCodes: ['+53'],
658-
currencies: ['CUP', 'CUC'],
659-
emoji: '🇨🇺',
660-
ioc: 'CUB',
661-
languages: ['spa'],
662-
name: 'Cuba',
663-
status: 'assigned',
664-
},
665632
{
666633
alpha2: 'CV',
667634
alpha3: 'CPV',
@@ -1383,17 +1350,6 @@ export default [
13831350
name: 'Iraq',
13841351
status: 'assigned',
13851352
},
1386-
{
1387-
alpha2: 'IR',
1388-
alpha3: 'IRN',
1389-
countryCallingCodes: ['+98'],
1390-
currencies: ['IRR'],
1391-
emoji: '🇮🇷',
1392-
ioc: 'IRI',
1393-
languages: ['fas'],
1394-
name: 'Iran, Islamic Republic Of',
1395-
status: 'assigned',
1396-
},
13971353
{
13981354
alpha2: 'IS',
13991355
alpha3: 'ISL',
@@ -1536,17 +1492,6 @@ export default [
15361492
name: 'Saint Kitts And Nevis',
15371493
status: 'assigned',
15381494
},
1539-
{
1540-
alpha2: 'KP',
1541-
alpha3: 'PRK',
1542-
countryCallingCodes: ['+850'],
1543-
currencies: ['KPW'],
1544-
emoji: '🇰🇵',
1545-
ioc: 'PRK',
1546-
languages: ['kor'],
1547-
name: "Korea, Democratic People's Republic Of",
1548-
status: 'assigned',
1549-
},
15501495
{
15511496
alpha2: 'KR',
15521497
alpha3: 'KOR',
@@ -1821,17 +1766,6 @@ export default [
18211766
name: 'Mali',
18221767
status: 'assigned',
18231768
},
1824-
{
1825-
alpha2: 'MM',
1826-
alpha3: 'MMR',
1827-
countryCallingCodes: ['+95'],
1828-
currencies: ['MMK'],
1829-
emoji: '🇲🇲',
1830-
ioc: 'MYA',
1831-
languages: ['mya'],
1832-
name: 'Myanmar',
1833-
status: 'assigned',
1834-
},
18351769
{
18361770
alpha2: 'MN',
18371771
alpha3: 'MNG',
@@ -2386,17 +2320,6 @@ export default [
23862320
name: 'Serbia',
23872321
status: 'assigned',
23882322
},
2389-
{
2390-
alpha2: 'RU',
2391-
alpha3: 'RUS',
2392-
countryCallingCodes: ['+7', '+7 3', '+7 4', '+7 8'],
2393-
currencies: ['RUB'],
2394-
emoji: '🇷🇺',
2395-
ioc: 'RUS',
2396-
languages: ['rus'],
2397-
name: 'Russia',
2398-
status: 'assigned',
2399-
},
24002323
{
24012324
alpha2: 'RW',
24022325
alpha3: 'RWA',
@@ -2638,17 +2561,6 @@ export default [
26382561
name: 'Sint Maarten',
26392562
status: 'assigned',
26402563
},
2641-
{
2642-
alpha2: 'SY',
2643-
alpha3: 'SYR',
2644-
countryCallingCodes: ['+963'],
2645-
currencies: ['SYP'],
2646-
emoji: '🇸🇾',
2647-
ioc: 'SYR',
2648-
languages: ['ara'],
2649-
name: 'Syrian Arab Republic',
2650-
status: 'assigned',
2651-
},
26522564
{
26532565
alpha2: 'SZ',
26542566
alpha3: 'SWZ',
@@ -2857,17 +2769,6 @@ export default [
28572769
name: 'Tanzania, United Republic Of',
28582770
status: 'assigned',
28592771
},
2860-
{
2861-
alpha2: 'UA',
2862-
alpha3: 'UKR',
2863-
countryCallingCodes: ['+380'],
2864-
currencies: ['UAH'],
2865-
emoji: '🇺🇦',
2866-
ioc: 'UKR',
2867-
languages: ['ukr', 'rus'],
2868-
name: 'Ukraine',
2869-
status: 'assigned',
2870-
},
28712772
{
28722773
alpha2: 'UG',
28732774
alpha3: 'UGA',
@@ -2955,17 +2856,6 @@ export default [
29552856
name: 'Viet-Nam, Democratic Republic of',
29562857
status: 'deleted',
29572858
},
2958-
{
2959-
alpha2: 'VE',
2960-
alpha3: 'VEN',
2961-
countryCallingCodes: ['+58'],
2962-
currencies: ['VEF'],
2963-
emoji: '🇻🇪',
2964-
ioc: 'VEN',
2965-
languages: ['spa'],
2966-
name: 'Venezuela, Bolivarian Republic Of',
2967-
status: 'assigned',
2968-
},
29692859
{
29702860
alpha2: 'VG',
29712861
alpha3: 'VGB',
@@ -3137,5 +3027,123 @@ export default [
31373027
languages: ['eng', 'sna', 'nde'],
31383028
name: 'Zimbabwe',
31393029
status: 'assigned',
3030+
}
3031+
]
3032+
3033+
// Here are the countries that are currently forbidden by insurances.
3034+
// This list should be in sync with the one in `src/util/email.ts`.
3035+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
3036+
const FORBIDDEN_COUNTRIES = [
3037+
{
3038+
alpha2: 'AF',
3039+
alpha3: 'AFG',
3040+
countryCallingCodes: ['+93'],
3041+
currencies: ['AFN'],
3042+
emoji: '🇦🇫',
3043+
ioc: 'AFG',
3044+
languages: ['pus'],
3045+
name: 'Afghanistan',
3046+
status: 'assigned',
3047+
},
3048+
{
3049+
alpha2: 'BY',
3050+
alpha3: 'BLR',
3051+
countryCallingCodes: ['+375'],
3052+
currencies: ['BYN'],
3053+
emoji: '🇧🇾',
3054+
ioc: 'BLR',
3055+
languages: ['bel', 'rus'],
3056+
name: 'Belarus',
3057+
status: 'assigned',
3058+
},
3059+
{
3060+
alpha2: 'CU',
3061+
alpha3: 'CUB',
3062+
countryCallingCodes: ['+53'],
3063+
currencies: ['CUP', 'CUC'],
3064+
emoji: '🇨🇺',
3065+
ioc: 'CUB',
3066+
languages: ['spa'],
3067+
name: 'Cuba',
3068+
status: 'assigned',
3069+
},
3070+
{
3071+
alpha2: 'IR',
3072+
alpha3: 'IRN',
3073+
countryCallingCodes: ['+98'],
3074+
currencies: ['IRR'],
3075+
emoji: '🇮🇷',
3076+
ioc: 'IRI',
3077+
languages: ['fas'],
3078+
name: 'Iran, Islamic Republic Of',
3079+
status: 'assigned',
3080+
},
3081+
{
3082+
alpha2: 'KP',
3083+
alpha3: 'PRK',
3084+
countryCallingCodes: ['+850'],
3085+
currencies: ['KPW'],
3086+
emoji: '🇰🇵',
3087+
ioc: 'PRK',
3088+
languages: ['kor'],
3089+
name: "Korea, Democratic People's Republic Of",
3090+
status: 'assigned',
3091+
},
3092+
{
3093+
alpha2: 'MM',
3094+
alpha3: 'MMR',
3095+
countryCallingCodes: ['+95'],
3096+
currencies: ['MMK'],
3097+
emoji: '🇲🇲',
3098+
ioc: 'MYA',
3099+
languages: ['mya'],
3100+
name: 'Myanmar',
3101+
status: 'assigned',
3102+
},
3103+
{
3104+
alpha2: 'RU',
3105+
alpha3: 'RUS',
3106+
countryCallingCodes: ['+7', '+7 3', '+7 4', '+7 8'],
3107+
currencies: ['RUB'],
3108+
emoji: '🇷🇺',
3109+
ioc: 'RUS',
3110+
languages: ['rus'],
3111+
name: 'Russia',
3112+
status: 'assigned',
3113+
},
3114+
{
3115+
alpha2: 'SY',
3116+
alpha3: 'SYR',
3117+
countryCallingCodes: ['+963'],
3118+
currencies: ['SYP'],
3119+
emoji: '🇸🇾',
3120+
ioc: 'SYR',
3121+
languages: ['ara'],
3122+
name: 'Syrian Arab Republic',
3123+
status: 'assigned',
3124+
},
3125+
{
3126+
alpha2: 'UA',
3127+
alpha3: 'UKR',
3128+
countryCallingCodes: ['+380'],
3129+
currencies: ['UAH'],
3130+
emoji: '🇺🇦',
3131+
ioc: 'UKR',
3132+
languages: ['ukr', 'rus'],
3133+
name: 'Ukraine',
3134+
status: 'assigned',
3135+
},
3136+
{
3137+
alpha2: 'VE',
3138+
alpha3: 'VEN',
3139+
countryCallingCodes: ['+58'],
3140+
currencies: ['VEF'],
3141+
emoji: '🇻🇪',
3142+
ioc: 'VEN',
3143+
languages: ['spa'],
3144+
name: 'Venezuela, Bolivarian Republic Of',
3145+
status: 'assigned',
31403146
},
31413147
];
3148+
3149+
export default COUNTRIES

src/components/VirtualLab/create-entity-flows/profile/elements.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import { CloseCircleFilled } from '@ant-design/icons';
2+
import { InputProps, InputRef, Input } from 'antd';
3+
import { ForwardedRef } from 'react';
4+
5+
import { classNames } from '@/util/utils';
26

37
export function ProfileError() {
48
return (
@@ -19,3 +23,30 @@ export function ProfileError() {
1923
</div>
2024
);
2125
}
26+
27+
export function XInput(
28+
{ placeholder, className, ...props }: InputProps,
29+
ref: ForwardedRef<InputRef>
30+
) {
31+
return (
32+
<Input
33+
ref={ref}
34+
placeholder={placeholder}
35+
className={classNames(
36+
'rounded-none border-0 border-b !border-primary-4 !bg-transparent px-1 font-bold tracking-wide text-white focus:ring-0',
37+
'hover:!bg-transparent hover:!text-white focus:!bg-transparent focus:!text-white [&_.ant-input-outlined]:!bg-transparent',
38+
'focus:border-pr placeholder:text-white hover:border-white focus:border-b-2',
39+
'focus-within:!border-b-2 focus-within:!border-primary-4 focus-within:!ring-0',
40+
'[&.ant-XInput-status-error]:!border-0 [&.ant-XInput-status-error]:!border-b-2 [&.ant-XInput-status-error]:!border-red-300',
41+
'[&.ant-XInput-status-error]:focus:!ring-0 ',
42+
className
43+
)}
44+
// eslint-disable-next-line react/jsx-props-no-spreading
45+
{...props}
46+
/>
47+
);
48+
}
49+
50+
export function Label({ title }: { title: string }) {
51+
return <span className="text-sm font-light text-primary-4">{title}</span>;
52+
}

0 commit comments

Comments
 (0)