Skip to content

Commit f58cebc

Browse files
authored
✨[Frontend] Denylist for (lite) registration emails (#6385)
1 parent 502ac45 commit f58cebc

File tree

4 files changed

+221
-14
lines changed

4 files changed

+221
-14
lines changed

services/static-webserver/client/source/class/osparc/auth/core/Utils.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ qx.Class.define("osparc.auth.core.Utils", {
5151
return isValid;
5252
},
5353

54+
denylistEmailValidator: function(denylist) {
55+
return emailValue => {
56+
let errorMessage = "";
57+
qx.util.Validate.checkEmail(emailValue, null, errorMessage);
58+
// if the email check goes through, check it now against the denylist
59+
if (denylist) {
60+
denylist.forEach(reg => {
61+
const re = new RegExp(reg);
62+
if (re.test(emailValue)) {
63+
errorMessage = qx.locale.Manager.tr("Invalid email address.<br>Please register using your university email address");
64+
throw new qx.core.ValidationError("Validation Error", errorMessage);
65+
}
66+
})
67+
}
68+
};
69+
},
70+
5471
/** Finds parameters in the fragment
5572
*
5673
* Expected fragment format as https://osparc.io#page=reset-password;code=123546

services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
1616
************************************************************************ */
1717

18+
/**
19+
* @asset(osparc/denylist.json")
20+
*/
21+
1822
qx.Class.define("osparc.auth.ui.RequestAccount", {
1923
extend: osparc.auth.core.BaseAuthPage,
2024

21-
22-
/*
23-
*****************************************************************************
24-
MEMBERS
25-
*****************************************************************************
26-
*/
27-
2825
members: {
2926
__captchaField: null,
3027
__requestButton: null,
@@ -57,15 +54,26 @@ qx.Class.define("osparc.auth.ui.RequestAccount", {
5754
required: true
5855
});
5956
switch (osparc.product.Utils.getProductName()) {
60-
case "s4l":
61-
case "tis":
62-
case "osparc":
63-
this._form.add(email, this.tr("Email"), qx.util.Validate.email(), "email");
64-
break;
65-
case "tiplite":
6657
case "s4lacad":
6758
case "s4ldesktopacad":
68-
this._form.add(email, this.tr("University Email"), qx.util.Validate.email(), "email");
59+
case "tiplite": {
60+
this._form.add(email, this.tr("University Email"), null, "email");
61+
let validator = qx.util.Validate.email();
62+
osparc.utils.Utils.fetchJSON("/resource/osparc/denylist.json")
63+
.then(denylistData => {
64+
if ("lite" in denylistData) {
65+
const denylist = denylistData["lite"];
66+
validator = osparc.auth.core.Utils.denylistEmailValidator(denylist);
67+
}
68+
})
69+
.catch(console.error)
70+
.finally(() => {
71+
this._form.getValidationManager().add(email, validator);
72+
});
73+
break;
74+
}
75+
default:
76+
this._form.add(email, this.tr("Email"), qx.util.Validate.email(), "email");
6977
break;
7078
}
7179

services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ qx.Class.define("osparc.navigation.NavigationBar", {
236236
marginRight: 30,
237237
...this.self().BUTTON_OPTIONS,
238238
});
239+
osparc.utils.Utils.setIdToWidget(control, "accessTIPBtn");
239240
control.addListener("execute", () => osparc.product.TIPTeaser.getInstance().open());
240241
this.getChildControl("right-items").add(control);
241242
break;
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
{
2+
"lite": [
3+
"@*\\.ir$",
4+
"@imanova\\.co\\.uk$",
5+
"@centrum\\.sk$",
6+
"@centrum\\.cz$",
7+
"@*\\.medical\\.canon$",
8+
"@gmail.com$",
9+
"@yahoo.com$",
10+
"@hotmail.com$",
11+
"@hotmail\\.*$",
12+
"@aol.com$",
13+
"@hotmail.co.uk$",
14+
"@hotmail.fr$",
15+
"@msn.com$",
16+
"@yahoo.fr$",
17+
"@wanadoo.fr$",
18+
"@orange.fr$",
19+
"@comcast.net$",
20+
"@yahoo.co.uk$",
21+
"@yahoo.com.br$",
22+
"@yahoo.co.in$",
23+
"@live.com$",
24+
"@rediffmail.com$",
25+
"@free.fr$",
26+
"@gmx.de$",
27+
"@web.de$",
28+
"@yandex.ru$",
29+
"@ymail.com$",
30+
"@libero.it$",
31+
"@outlook.com$",
32+
"@uol.com.br$",
33+
"@bol.com.br$",
34+
"@mail.ru$",
35+
"@cox.net$",
36+
"@hotmail.it$",
37+
"@sbcglobal.net$",
38+
"@sfr.fr$",
39+
"@live.fr$",
40+
"@verizon.net$",
41+
"@live.co.uk$",
42+
"@googlemail.com$",
43+
"@yahoo.es$",
44+
"@ig.com.br$",
45+
"@live.nl$",
46+
"@bigpond.com$",
47+
"@terra.com.br$",
48+
"@yahoo.it$",
49+
"@neuf.fr$",
50+
"@yahoo.de$",
51+
"@alice.it$",
52+
"@rocketmail.com$",
53+
"@att.net$",
54+
"@laposte.net$",
55+
"@facebook.com$",
56+
"@bellsouth.net$",
57+
"@yahoo.in$",
58+
"@hotmail.es$",
59+
"@charter.net$",
60+
"@yahoo.ca$",
61+
"@yahoo.com.au$",
62+
"@rambler.ru$",
63+
"@hotmail.de$",
64+
"@tiscali.it$",
65+
"@shaw.ca$",
66+
"@yahoo.co.jp$",
67+
"@sky.com$",
68+
"@earthlink.net$",
69+
"@optonline.net$",
70+
"@freenet.de$",
71+
"@t-online.de$",
72+
"@aliceadsl.fr$",
73+
"@virgilio.it$",
74+
"@home.nl$",
75+
"@qq.com$",
76+
"@telenet.be$",
77+
"@me.com$",
78+
"@yahoo.com.ar$",
79+
"@tiscali.co.uk$",
80+
"@yahoo.com.mx$",
81+
"@voila.fr$",
82+
"@gmx.net$",
83+
"@mail.com$",
84+
"@planet.nl$",
85+
"@tin.it$",
86+
"@live.it$",
87+
"@ntlworld.com$",
88+
"@arcor.de$",
89+
"@yahoo.co.id$",
90+
"@frontiernet.net$",
91+
"@hetnet.nl$",
92+
"@live.com.au$",
93+
"@yahoo.com.sg$",
94+
"@zonnet.nl$",
95+
"@club-internet.fr$",
96+
"@juno.com$",
97+
"@optusnet.com.au$",
98+
"@blueyonder.co.uk$",
99+
"@bluewin.ch$",
100+
"@skynet.be$",
101+
"@sympatico.ca$",
102+
"@windstream.net$",
103+
"@mac.com$",
104+
"@centurytel.net$",
105+
"@chello.nl$",
106+
"@live.ca$",
107+
"@aim.com$",
108+
"@bigpond.net.au$",
109+
"@gmail.comgmx.com$",
110+
"@google.com$",
111+
"@email.com$",
112+
"@fastmail.fm$",
113+
"@games.com$",
114+
"@hush.com$",
115+
"@hushmail.com$",
116+
"@icloud.com$",
117+
"@iname.com$",
118+
"@inbox.com$",
119+
"@lavabit.com$",
120+
"@love.com$",
121+
"@pobox.com$",
122+
"@protonmail.com$",
123+
"@safe-mail.net$",
124+
"@wow.com$",
125+
"@ygm.com$",
126+
"@zoho.com$",
127+
"@yandex.com$",
128+
"@btinternet.com$",
129+
"@virginmedia.com$",
130+
"@freeserve.co.uk$",
131+
"@o2.co.uk$",
132+
"@orange.net$",
133+
"@talktalk.co.uk$",
134+
"@virgin.net$",
135+
"@wanadoo.co.uk$",
136+
"@bt.com$",
137+
"@sina.com$",
138+
"@sina.cn$",
139+
"@naver.com$",
140+
"@hanmail.net$",
141+
"@daum.net$",
142+
"@nate.com$",
143+
"@yahoo.co.kr$",
144+
"@yahoo.com.ph$",
145+
"@163.com$",
146+
"@126.com$",
147+
"@aliyun.com$",
148+
"@foxmail.com$",
149+
"@gmx.frsfr.fr$",
150+
"@live.de$",
151+
"@online.de$",
152+
"@web.deyahoo.de$",
153+
"@aol.it$",
154+
"@email.it$",
155+
"@poste.it$",
156+
"@teletu.it$",
157+
"@ya.ru$",
158+
"@list.ru$",
159+
"@hotmail.be$",
160+
"@live.be$",
161+
"@voo.be$",
162+
"@tvcablenet.be$",
163+
"@hotmail.com.ar$",
164+
"@live.com.ar$",
165+
"@live.cn$",
166+
"@fibertel.com.ar$",
167+
"@speedy.com.ar$",
168+
"@arnet.com.ar$",
169+
"@live.com.mx$",
170+
"@hotmail.com.mx$",
171+
"@prodigy.net.mx$",
172+
"@hotmail.com.br$",
173+
"@outlook.com.br$",
174+
"@itelefonica.com.br$",
175+
"@r7.com$",
176+
"@zipmail.com.br$",
177+
"@globo.com$",
178+
"@globomail.com$",
179+
"@oi.com.br$"
180+
]
181+
}

0 commit comments

Comments
 (0)